COLLATE Clause in SQL Server Transact-SQL

Q

How To Specify the Collation for a Character Data Type in SQL Server Transact-SQL?

✍: FYIcenter.com

A

If you do not want to use the default collation provided by the SQL Server, you can use the "COLLATE collation_name" clause to specify a different collation to be used at different levels:

  • Database Level - Used in CREATE DATABASE or ALTER DATABASE statements to set a new default collation for the entire database.
  • Table Column Level - Used in CREATE TABLE or ALTER TABLE statements to override the database default collation for this column.
  • Character String Expression Level - Used at the end of the expression to cast the expression to the specified collation.

 

Casting Strings to Wrong Code Pages in SQL Server Transact-SQL

Default Collation in SQL Server Transact-SQL

Data Literals in SQL Server Transact-SQL

⇑⇑ SQL Server Transact-SQL Tutorials

2017-05-13, 1676🔥, 0💬