Home All Groups Group Topic Archive Search About

T-SQL...How to set column collation to database default?

Author
21 Oct 2005 8:59 AM
throat.wobbler.mangrove
Hi,

Does anyone know the T-SQL code I need to set the collation of a column
to the database default?

Following books online, I have tried:

ALTER <TABLENAME>
ALTER <COLUMNNAME>
COLLATE DEFAULT
GO

but this doesn't seem to be correct. I'd be grateful for any
assistance!

Many thanks.

TWM

Author
21 Oct 2005 10:34 AM
Erland Sommarskog
(throat.wobbler.mangr***@gmail.com) writes:
> Does anyone know the T-SQL code I need to set the collation of a column
> to the database default?
>
> Following books online, I have tried:
>
> ALTER <TABLENAME>
> ALTER <COLUMNNAME>
> COLLATE DEFAULT
> GO
>
> but this doesn't seem to be correct. I'd be grateful for any
> assistance!

   CREATE TABLE #a (i varchar(12) NOT NULL)
   ALTER TABLE #a
       ALTER COLUMN i varchar(12) COLLATE database_default NOT NULL

--
Erland Sommarskog, SQL Server MVP, esq***@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinfo/productdoc/2000/books.asp
Author
21 Oct 2005 10:40 AM
throat.wobbler.mangrove
Thank you, much appreciated

AddThis Social Bookmark Button