SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Changing table/column collation


Changing table/column collation

Author
Message
Stueyd
Stueyd
Old Hand
Old Hand (372 reputation)Old Hand (372 reputation)Old Hand (372 reputation)Old Hand (372 reputation)Old Hand (372 reputation)Old Hand (372 reputation)Old Hand (372 reputation)Old Hand (372 reputation)

Group: General Forum Members
Points: 372 Visits: 307
Hi All,

I am currently testing migrating a database from SQL 7 to SQL 2005.
Following a backup/copy/restore to the new server, the database now has a backwards compatibilty collation of SQL_Latin1_General_CP1_CI_AS.
I have changed the database itself to be Latin1_General_CI_AS but (as expected) the collation at a column level remains SQL_Latin1_General_CP1_CI_AS, so this needs changing.

I found a nifty script on this website (LM_ChangeCollation) which uses a cursor to go through all the tables and do a Alter Table Alter Column Collate.
Genius!
Except it doesn't work :-(

It appears that if you have any sort of constraint it fails with the following message:

"Msg 5074, Level 16, State 1, Line 1
The object 'MY_CLUSTERED_INDEX' is dependent on column 'my_column'.
Msg 4922, Level 16, State 9, Line 1
ALTER TABLE ALTER COLUMN my_column failed because one or more objects access this column."

So, Anyone got any advice on how to change collation on columns where you have constraints without any major pain?

Cheers!

Stu.



Chandra Sekhara Vyas Dhara
Chandra Sekhara Vyas Dhara
SSCertifiable
SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)

Group: General Forum Members
Points: 5119 Visits: 1149
Check the following link may be useful

http://drsql.spaces.live.com/blog/cns!80677FB08B3162E4!1333.entry



Andras Belokosztolszki
Andras Belokosztolszki
SSCertifiable
SSCertifiable (5.5K reputation)SSCertifiable (5.5K reputation)SSCertifiable (5.5K reputation)SSCertifiable (5.5K reputation)SSCertifiable (5.5K reputation)SSCertifiable (5.5K reputation)SSCertifiable (5.5K reputation)SSCertifiable (5.5K reputation)

Group: General Forum Members
Points: 5541 Visits: 1585
Also see http://www.sqlservercentral.com/Forums/Topic443054-5-1.aspx. Same tools though. BigGrin (of course I'm biased)

Regards,
Andras



Andras Belokosztolszki, MCPD, PhD
GoldenGate Software
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search