有没有办法更改 FixedLenNullInSource 和 TrimTrailingBlanks 的值? [英] Is there a way to change the values for FixedLenNullInSource and TrimTrailingBlanks?

查看:26
本文介绍了有没有办法更改 FixedLenNullInSource 和 TrimTrailingBlanks 的值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法改变 FixedLenNullInSourceTrimTrailingBlanks 的值?

Is there a way to change the values for FixedLenNullInSource and TrimTrailingBlanks?

我使用 sp_help 来比较来自不同服务器的输出以查看表是否相同.FixedLenNullInSourceTrimTrailingBlanks 正在抛弃我的比较.

I use sp_help to compare the output from different servers to see if the tables are identical. FixedLenNullInSource and TrimTrailingBlanks are throwing my comparisons off.

推荐答案

TrimTrailingBlanks 与创建表时的 SET ANSI_PADDING 选项相关.您也许可以更改它,而无需以类似于 我在这里的答案 用于更改 ANSI_NULL 选项.

TrimTrailingBlanks relates to the SET ANSI_PADDING option when the table was created. You might be able to change that without recreating the whole table in a similar way to my answer here for changing the ANSI_NULL option.

否则,您将需要使用选定的所需语义重新创建表.

Otherwise you would need to recreate the table with the desired semantics selected.

sp_help的定义

   'FixedLenNullInSource' = 
   CASE
        WHEN Type_name(system_type_id) NOT IN ( 'varbinary', 'varchar', 'binary', 'char' ) THEN '(n/a)'
        WHEN is_nullable = 0 THEN @no
        ELSE @yes
    END 

所以 FixedLenNullInSource 的不同值只是表明该列的可空性不同,并且它是 4 种指定数据类型之一.您需要使用 ALTER TABLE ... ALTER COLUMN

so it appears different values for FixedLenNullInSource just indicate that the nullability of the column is different and that it is one of the 4 specified datatypes. You would need to fix that with ALTER TABLE ... ALTER COLUMN

您最好使用第三方工具来比较数据库,例如 Redgate SQL Compare 或 SQL Server Data Tools,甚至只是查询 sys.tablessys.columns 自己,而不是使用 sp_help.

You are probably much better off using a third party tool to compare the databases such as Redgate SQL Compare or SQL Server Data Tools or even just querying sys.tables and sys.columns yourself rather than using sp_help though.

这篇关于有没有办法更改 FixedLenNullInSource 和 TrimTrailingBlanks 的值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆