changing column collation

  • I have a request related collation. I have found some varchar columns on the database that had a different collation than the database_default.

     Is there a general function that could allign all varchar columns to use the database default collation? And could you do this? If not could you give me a script sample how to do this in sql script? I would then scan the database and write a script for all columns needing change.

    thanks

     


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

  • This is scary since it involves messing with the system tables directly - but I guess if you try running it first (& second & third...) on a test environment, then you could do the same in production (after making sure you have backups of course...) - ie - update the syscolumns directly

    update syscolumns
    set collationid = ##########
    where name in
    (select sc.name from syscolumns sc
    inner join sysobjects so
    on sc.id = so.id
    where so.xtype = 'u'
    and sc.collationid = #########)
    







    **ASCII stupid question, get a stupid ANSI !!!**

  • Thanks Sushila for the update. Let me give a try


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

Viewing 3 posts - 1 through 3 (of 3 total)

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