Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

how to alter primary key int datatype to uniqueidentifier Expand / Collapse
Author
Message
Posted Tuesday, November 10, 2009 6:54 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Wednesday, December 2, 2009 12:19 AM
Points: 108, Visits: 248

hi

help me..

how to alter primary key int datatype to uniqueidentifier


Thanks
Dastagiri.D
Post #816464
Posted Tuesday, November 10, 2009 6:57 AM


SSCoach

SSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoach

Group: General Forum Members
Last Login: Friday, June 27, 2014 12:43 PM
Points: 15,444, Visits: 9,596
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
Post #816469
Posted Tuesday, November 10, 2009 7:02 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Wednesday, December 2, 2009 12:19 AM
Points: 108, Visits: 248
hi..

any code.

i need t-sql query for alter int to uniqueidentifier



Thanks
Dastagiri.D
Post #816474
Posted Tuesday, November 10, 2009 7:31 AM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 4:03 PM
Points: 42,485, Visits: 35,554
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 2008, MVP
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #816518
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse