May 6, 2008 at 10:37 am
Hi
I had created a table with COLLATE as LATIN..
Now i am in need of collate.. I want to drop or disable the COLLATE for that particluar table..
Regards
May 6, 2008 at 12:06 pm
sharma (5/6/2008)
HiI had created a table with COLLATE as LATIN..
Now i am in need of collate.. I want to drop or disable the COLLATE for that particular table..
Regards
First I did not get your question. Second, I tried to change collation property of one of my table and you can change it explicitly. Check BOL for alter table statement.
or
create a temporary table with collation you want -> copy the data in temporary table -> drop the original table and then rename the temporary table to original.
SQL DBA.
May 7, 2008 at 7:05 am
Not a table level.
In table one column is in COLLATE constraint.
How to disable it?
Thanks
May 7, 2008 at 8:38 am
Try this.
ALTER TABLE tablename
ALTER COLUMN columnname COLLATE default
SQL DBA.
May 8, 2008 at 5:20 am
Thanks SanjayAttray
I did
ALTER TABLE NVARCHARTBL
ALTER COLUMN NAME COLLATE default
The above query is correct?
Bcoz It shows error
Msg 156, Level 15, State 1, Line 2
Incorrect syntax near the keyword 'COLLATE'.
Regards
May 9, 2008 at 7:14 am
sharma (5/8/2008)
Thanks SanjayAttrayI did
ALTER TABLE NVARCHARTBL
ALTER COLUMN NAME COLLATE default
The above query is correct?
Bcoz It shows error
Msg 156, Level 15, State 1, Line 2
Incorrect syntax near the keyword 'COLLATE'.
Regards
ALTER COLUMN NAME COLLATE database_default
MG
"There are two ways of constructing a software design. One way is to make it so simple that there are obviously no deficiencies. And the other way is to make it so complicated that there are no obvious deficiencies."
Tony Hoare
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.
May 9, 2008 at 1:00 pm
Hi.. Same Error...
Msg 156, Level 15, State 1, Line 2
Incorrect syntax near the keyword 'COLLATE'.
May 9, 2008 at 1:15 pm
Sorry - I forgot that the less than and greater than symbols are for html tags so it come out right
ALTER TABLENAME
ALTER COLUMN COLUMN NAME COLLATE database_default
MG
"There are two ways of constructing a software design. One way is to make it so simple that there are obviously no deficiencies. And the other way is to make it so complicated that there are no obvious deficiencies."
Tony Hoare
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.
May 9, 2008 at 1:56 pm
I got the same error while running this script.
I have no problem in changing the collation in GUI but I do have problem in changing it using script in both SQL 2000/2005.
May 9, 2008 at 3:02 pm
Hi
Can you provide the clear script..
Bcoz same error.
May 12, 2008 at 12:59 am
[font="Comic Sans MS"][font="Comic Sans MS"]Hi
This link may be useful to you...
http://msdn.microsoft.com/en-us/library/ms190920.aspx
Thanks
jaypee.s[/font]
January 20, 2009 at 8:21 am
Hi!
There is a script to change the collation of an entire database at this link:
http://www.sqlservercentral.com/scripts/Miscellaneous/30471/[/url]
The correct syntax may be like this:
ALTER TABLE tablename
ALTER COLUMN columnname type (length) COLLATE database_default
I've tried this:
ALTER TABLE TableName
ALTER COLUMN ColumnName varchar (50) COLLATE database_default
and it works
November 17, 2009 at 9:23 am
I have the exact same issue today. I need to change the collation setting on approx 500 columns and was looking for a way to do this quickly. I found a script on a forum that will update the collationid in syscolumns but it is a backdoor method so I will not post it here.
You can use ALTER table and I have tested this. BUT, I think you must specify the datatype of the column and the Allow Nulls attribute also.
So for example :
ALTER TABLE <table> ALTER COLUMN <column> <type> COLLATE <collation> <allow_nulls>
ALTER TABLE jb_test ALTER COLUMN jb_id varchar(30) COLLATE Latin1_General_BIN NOT NULL
This works but is a pain because you need to specify those other attributes and therefore you have to first query the database to check what those attributes need to be set to for each column you want to alter. Also, if you have indexes or primary keys defined on those columns then the statement fails. This is all handled neatly by the management Studio which is why I have resorted to a manual update. Hope this helps.
November 17, 2009 at 12:37 pm
John Burgess-239089 (11/17/2009)
I found a script on a forum that will update the collationid in syscolumns but it is a backdoor method so I will not post it here.
I would suggest you don't try and run it. That's the kind of thing that results in nasty, hard-to-fix schema corruption. Besides, it won't work at all on SQL 2005. In 2005 and above, updates are not allowed at all to the system tables (besides which, the system tables are hidden) and syscolumns is just a view
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
Viewing 14 posts - 1 through 13 (of 13 total)
You must be logged in to reply to this topic. Login to reply