Change COLLATE of all columns of all tables in MS SQL
I imported a database with some data to compare with another database. The
target database has collation Latin1_General_CI_AS and the source database
has SQL_Latin1_General_CP1_CI_AS.
I did change the collation of the source database in general to
Latin1_General_CI_AS using the SQL management studio. But the tables and
columns inside remains with the old collation.
I know that I can change a column using:
ALTER TABLE [table] ALTER COLUMN [column] varchar(100) COLLATE
Latin1_General_CI_AS
But I have to do this for all tables and all columns inside.
Before I know start to write a stored procedure that reads all tables and
inside all column of type varchar() and change them in a table and column
cursor loop...
Does anyone know a easier way or is the only way to do this with a script
running through all tables in a procedure?
No comments:
Post a Comment