Is there a way to get the 'Script Table as' > 'CREATE To' option for tables in SQL Server Management Studio to preserve the collation types set for each column?
I know it's possible to specify collation types for columns when creating tables so I find it odd that these settings aren't present in the script output by SSMS.
The server collation is specified during SQL Server installation. The default server-level collation is based upon the locale of the operating system. For example, the default collation for systems using US English (en-US) is SQL_Latin1_General_CP1_CI_AS.
These are definitely obsolete, even if not officially deprecated, and are mainly for pre-SQL Server 2000 compatibility. Although, quite unfortunately SQL_Latin1_General_CP1_CI_AS is very common due to it being the default when installing on an OS using US English as its language.
The SQL_Latin1_General_CP1_CI_AS collation is a SQL collation and the rules around sorting data for unicode and non-unicode data are different. The Latin1_General_CI_AS collation is a Windows collation and the rules around sorting unicode and non-unicode data are the same.
Go to Tools -> Options.
Expand "Sql Server Object Explorer" -> Scripting and there is an option "Include collation" you can enable there in the "Table and view options" category (the default value is false).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With