x

can we change collation of the DB after it has filled with some data?

Can we change collation of the db after it has filled with some data..?
more ▼

asked Apr 13, 2011 at 08:27 AM in Default

Manikreddy gravatar image

Manikreddy
414 24 26 28

(comments are locked)
10|1200 characters needed characters left

2 answers: sort voted first

Yes you can. There are some things to check prior to doing it. This link has the information: [ALTER DATABASE (Transact-SQL)][1] See the section "Changing the Database Collation"

[1]: http://msdn.microsoft.com/en-us/library/ms174269.aspx
more ▼

answered Apr 13, 2011 at 08:51 AM

Shawn_Melton gravatar image

Shawn_Melton
5.3k 19 21 29

(comments are locked)
10|1200 characters needed characters left

You can change the collation of a database at any time, but only new objects will have the new collation. To change existing objects you would need to script out each column of each object that has the collation (i.e. character fields) for example:

ALTER TABLE MyTable
ALTER COLUMN MyCol VARCHAR(10)
COLLATE NewCollation 

[MSDN link][1]

[1]: http://msdn.microsoft.com/en-us/library/ms190920.aspx
more ▼

answered Apr 13, 2011 at 08:54 AM

Kev Riley gravatar image

Kev Riley ♦♦
52.8k 47 49 76

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

New code box

There's a new way to format code on the site - the red speech bubble logo will automatically format T-SQL for you. The original code box is still there for XML, etc. More details here.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x22

asked: Apr 13, 2011 at 08:27 AM

Seen: 701 times

Last Updated: Apr 13, 2011 at 08:27 AM