How to change the database collation

By | January 2, 2012
To change the collation of an database following commands can be used:

ALTER DATABASE [database name] SET SINGLE_USER WITH ROLLBACK IMMEDIATE
ALTER DATABASE  [database name]  COLLATE Newcollation
ALTER DATABASE  [database name]  SET MULTI_USER
For example , suppose if the name of your database is learningdb and you want to change the collation to the collation SQL_Latin1_General_CP1257_CI_AS, then following commands can be used:-
ALTER DATABASE 
learningdb  SET SINGLE_USER WITH ROLLBACKIMMEDIATE
ALTER DATABASE 
learningdb  COLLATE SQL_Latin1_General_CP1257_CI_AS
ALTER DATABASE 
learningdb  SET MULTI_USER

Leave a Reply