Showing posts with label collation. Show all posts
Showing posts with label collation. Show all posts

Monday, March 26, 2012

How can i change collation of userdefined datatype?


Hi everyone?

How can i change collation of userdefined datatype?
When i try to change it Management Studio Query


varcharUzun = varchar(100) --> userdefined data type....

[code]ALTER TABLE tbxxxx ALTER COLUMN sDefinition varcharUzun COLLATE Turkish_CI_AS NOT NULL [/code]

when i run the query it says.
[code]
Msg 452, Level 16, State 1, Line 2
COLLATE clause cannot be used on user-defined data types.
[/code]


i also cannot ALTER the userdefinedtypes collation itself. And i canyt chance the collation if the column is PrimaryKey Sad
Is there any other to change the collation without dropping and re-creating the objects.

Thanks.

Hi Cem,

I don't htink you can set collation for a column that is using USER DEFINED DATATYPE.

If you do need to use the collation, just use the system datatype varchar(100), instead of user-defined, on that column.

regards

Jag

|||

Thanks Jag

but i have to use user defined datatypes.

No way to change the COLLATION of TYPES..... i couldnt find any ALTER TYPE xxxx COLLATE = xxx :(

And also how can i change the collation of PrimaryKey (varchar(10))....

2 Main problems:(

cemuney

|||

Hi Cem,

I dont think you can change the collation for user defined data type.

To change collation for a particular column try the following:

ALTER TABLE <tableName>

ALTER COLUMN <columnName> VARCHAR(10) COLLATE <collationName>

Let me know how you got on.

regards

Jag

|||

Hi Jag

i understant that UDDType do not have collations itself.

it is coming from the DATABASE's default collation.

When i change the COLLATION of database, also UDDType's collation also changes.

thanks anyway.

How can i change collation of userdefined datatype?


Hi everyone?

How can i change collation of userdefined datatype?
When i try to change it Management Studio Query


varcharUzun = varchar(100) --> userdefined data type....

[code]ALTER TABLE tbxxxx ALTER COLUMN sDefinition varcharUzun COLLATE Turkish_CI_AS NOT NULL [/code]

when i run the query it says.
[code]
Msg 452, Level 16, State 1, Line 2
COLLATE clause cannot be used on user-defined data types.
[/code]


i also cannot ALTER the userdefinedtypes collation itself. And i canyt chance the collation if the column is PrimaryKey Sad
Is there any other to change the collation without dropping and re-creating the objects.

Thanks.

Hi Cem,

I don't htink you can set collation for a column that is using USER DEFINED DATATYPE.

If you do need to use the collation, just use the system datatype varchar(100), instead of user-defined, on that column.

regards

Jag

|||

Thanks Jag

but i have to use user defined datatypes.

No way to change the COLLATION of TYPES..... i couldnt find any ALTER TYPE xxxx COLLATE = xxx :(

And also how can i change the collation of PrimaryKey (varchar(10))....

2 Main problems:(

cemuney

|||

Hi Cem,

I dont think you can change the collation for user defined data type.

To change collation for a particular column try the following:

ALTER TABLE <tableName>

ALTER COLUMN <columnName> VARCHAR(10) COLLATE <collationName>

Let me know how you got on.

regards

Jag

|||

Hi Jag

i understant that UDDType do not have collations itself.

it is coming from the DATABASE's default collation.

When i change the COLLATION of database, also UDDType's collation also changes.

thanks anyway.

sql

How can i chang server level collation

Dear All,
How can i change my SQL server level collation.
Thank's in advance.
Faheem Latif
Network Solutions PVT LTM.
Pakistan.You can rebuild the master database. There is a bug with this if you use
sourcefiles off the cd, so have a look at these articles:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/howtosql/ht_install_8w8p.asp
http://support.microsoft.com/default.aspx?scid=kb;en-us;273572
Be very careful with this, as you'll need to have scripts of logins, linked
servers, messages and anything else you have in master and corresponding
scripts of MSDB's objects, all of which can then be recreated afterwards.
Actually you might not need to jump through all these hoops - why is it that
you want to change the collation?
Rgds,
Paul Ibison SQL Server MVP, www.replicationanswers.com
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)

How can i chang server level collation

Dear All,
How can i change my SQL server level collation.
Thank's in advance.
Faheem Latif
Network Solutions PVT LTM.
Pakistan.
You can rebuild the master database. There is a bug with this if you use
sourcefiles off the cd, so have a look at these articles:
http://msdn.microsoft.com/library/de...stall_8w8p.asp
http://support.microsoft.com/default...b;en-us;273572
Be very careful with this, as you'll need to have scripts of logins, linked
servers, messages and anything else you have in master and corresponding
scripts of MSDB's objects, all of which can then be recreated afterwards.
Actually you might not need to jump through all these hoops - why is it that
you want to change the collation?
Rgds,
Paul Ibison SQL Server MVP, www.replicationanswers.com
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)