Change collation.

How do I change the collation of my database from Latin1_General_CI_AS to SQL_Latin1_General_CP1_CI_AS.
Mr_ShawAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Imran Javed ZiaConsultant Software Engineer - .NET ArchitectCommented:
you can use
Setup /QUIET /ACTION=REBUILDDATABASE /INSTANCENAME=InstanceName
/SQLSYSADMINACCOUNTS=accounts /[ SAPWD= StrongPassword ]
/SQLCOLLATION=CollationName


You may find following articals helpful
http://msdn.microsoft.com/en-us/library/ms179254.aspx
http://www.databasejournal.com/features/mssql/article.php/3302341/SQL-Server-and-Collation.htm
0
Mr_ShawAuthor Commented:
This change is for my local instance of SQL Server 2005.

I have tried:

Setup /QUIET /ACTION=REBUILDDATABASE / SQLCOLLATION='SQL_Latin1_General_CP1_CI_AS'

But i get an error reading

Incorrect syntax near '/'.
0
Daniel_PLDB Expert/ArchitectCommented:
Do not rebuild system databases. You will lose all settings!!!
USE master
GO
ALTER DATABASE <yourdbname> COLLATE SQL_Latin1_General_CP1_CI_AS
GO

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Daniel_PLDB Expert/ArchitectCommented:
Additionally when you need to change default server collation there's no other way than rebuilding all system databases but when you only need to change collation for your database just change its COLLATE property as I posted above. You are able to keep your settings but it's a lot more to do than just changing colaltion for user database.
0
Mr_ShawAuthor Commented:
thanks Daniel PL.

I ran you script and got the following error:

The database could not be exclusively locked to perform the operation.
Msg 5072, Level 16, State 1, Line 1
ALTER DATABASE failed.The default collation of database 'DBName' cannot be set to SQL_Latin1_General_CP1_CI_AS.
0
Daniel_PLDB Expert/ArchitectCommented:
You have connections in that database.
You can either kill all sessions one by one or set database to either sigle user or restricted user mode:

ALTER DATABASE SINGLE_USER ROLLBACK IMMEDIATE
ALTER DATABASE RESTRICTED_USER ROLLBACK IMMEDIATE
0
Mr_ShawAuthor Commented:
thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2008

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.