Table Collation

  • Hi,

     

    I'm fairly new to SQL - Is there a script that I can use to see which tables have the 'Use Collation' implemented?

     

    Thanks

     

    Steve

  • Try something like

    select distinct object_name(a.id) table_name, b.collation

     from syscolumns a inner join systypes b on a.xusertype = b.xusertype

     where a.collationid = b.collationid

     and not exists(select * from sysobjects c where a.id = c.id and c.xtype = 's')

     order by 1

    It lists all table collation combination.

  • Thanks for the info - works great.

    Is there a script that I can use that will tell me which columns are using a 'COLLATE" clause?

    Thanks

    Steve

  • Hai,

    Simply modify the above query

    select  name as column_name , collation collation_name ,id from syscolumns where id in (select id from sysobjects where name ='thetable') and collation is not null

     

     


    Helen
    --------------------------------
    Are you a born again. He is Jehova Jirah unto me

  • select object_name(a.id) table_name, a.name, b.collation

     from syscolumns a inner join systypes b on a.xusertype = b.xusertype

     where a.collationid = b.collationid

     and not exists(select * from sysobjects c where a.id = c.id and c.xtype = 's')

     order by 1, 2

  • You could alos try:

    SELECT Table_Name, Column_Name, Data_Type ,Collation_Name

    FROM information_schema.COLUMNS

    WHERE Collation_Name IS NOT NULL

     

  • A recommended way.

    Thanks

  • Hi There,

    Thanks for all your reply's - they've been really useful.

    Thanks

    Steve

Viewing 8 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic. Login to reply