Welcome to Sign in | Help

Re: COLLATION change

  •  11-01-2006, 1:09 PM

    Re: COLLATION change

    Este ok scriptul 

    Cred ca mai trebuie adaugat si : and SO.xtype='U' in clauza where pt a lua numai tabelele USER

    deci in final arata cam asa :

    DECLARE @myCollation NVARCHAR(4000);
    SET @myCollation = N'Latin1_General_BIN'
    SELECT
     'ALTER TABLE [' + SO.name + '] ' +
     'ALTER COLUMN [' + SC.name + '] ' +
     ST.name + '(' + cast(SC.length as varchar) + ') ' +
     'COLLATE ' + @myCollation -- SC.collation -- Original collation
     + ' ' +
     CASE WHEN SC.isnullable = 1 THEN 'NULL' ELSE 'NOT NULL' END SqlStatement
     FROM syscolumns SC
     JOIN sysobjects SO ON SO.id = SC.id
     JOIN systypes ST ON ST.xtype = SC.xtype
     WHERE SC.collation IS NOT NULL
     and SO.xtype='U'

    Multam mult 

    Mihai

     

     

     

View Complete Thread
Powered by Community Server (Commercial Edition), by Telligent Systems