List columns where collation doesn't match database collation

Posted by TiborKaraszi on SQL Blog See other posts from SQL Blog or by TiborKaraszi
Published on Wed, 23 May 2012 16:58:00 GMT Indexed on 2012/06/05 16:45 UTC
Read the original article Hit count: 388

Filed under:
Below script lists all database/table/column where the column collation doesn't match the database collation. I just wrote it for a migration project and thought I'd share it. I'm sure lots of tings can be improved, but below worked just fine for me for a one-time execution on a number of servers. IF OBJECT_ID ( 'tempdb..#res' ) IS NOT NULL DROP TABLE #res GO DECLARE @db sysname , @sql nvarchar ( 2000 ) CREATE TABLE #res ( server_name sysname , db_name sysname , db_collation sysname , table_name...(read more)

© SQL Blog or respective owner