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

ⅰ亾dé卋堺 提交于 2019-12-20 02:31:02

问题


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

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.


回答1:


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.

Looking at the definition of 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 

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

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.



来源:https://stackoverflow.com/questions/13508162/is-there-a-way-to-change-the-values-for-fixedlennullinsource-and-trimtrailingbla

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!