November 10, 2009 at 6:54 am
hi
help me..
how to alter primary key int datatype to uniqueidentifier
Thanks
Dastagiri.D
November 10, 2009 at 6:57 am
Drop the PK constraint.
Add the UID column, add a PK constraint to that.
Drop the old ID column.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
November 10, 2009 at 7:02 am
hi..
any code.
i need t-sql query for alter int to uniqueidentifier
Thanks
Dastagiri.D
November 10, 2009 at 7:31 am
Look up ALTER TABLE in books online (web version: http://msdn.microsoft.com/en-us/library/ms190273%28SQL.90%29.aspx)
ALTER TABLE ... DROP CONSTRAINT ... to remove the pk
ALTER TABLE ... ADD ... to add a new column
ALTER TABLE ... DROP ... to drop the old column
ALTER TABLE ... ADD CONSTRAINT ... to replace the pk constraint.
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 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply