How to set collation to the table?

  • Hi,

    I need to set a collation of one table to another.

    I'm using following code.

    declare @collation1 int

    Set @collation1 = (select collation from sysobjects so

    inner join syscolumns sc

    on so.id = sc.id and sc.name = 'uiName'

    where so.name like 'Dictionary')

    if ( exists ( select * from sysobjects where name = '#a' ) )

    drop table #a

    GO

    CREATE TABLE #a(ObjectIdHi int, ObjectIdLo int, OwnerIdHi int, OwnerIdLo int, OwnerPath varchar(200) COLLATE collation1, uiName varchar(200) COLLATE @collation1) select d.ObjectIdHi, d.ObjectIdLo, d.OwnerIdHi, d.OwnerIdLo, d.OwnerPath, d.uiName

    from #ObjList d

    But in at CREATE TABLE statement I'm getting the below error

    Invalid collation 'collation1'.

    How to resolve this error?

    Please help me.

  • [font="Verdana"]Its not possible to set collation at run time. Mention the exact collation.[/font]

    MH-09-AM-8694

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

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