Print Page | Close Window

Identity columns

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Database Discussion
Forum Description: Discussion and chat on database related topics.
URL: https://forums.webwiz.net/forum_posts.asp?TID=13723
Printed Date: 30 March 2026 at 4:18am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Identity columns
Posted By: Gullanian
Subject: Identity columns
Date Posted: 08 February 2005 at 8:13pm
Please could anyone quickly tell me in ASP with SQL Server how to change the column 'id' to an identity column?



Replies:
Posted By: michael
Date Posted: 08 February 2005 at 10:12pm
Basically you cannot. There is a way around where you could do somethinglike

Select * into #tmp from yourtable where id=[id_to_change]
Delete from yourtable where id=[id_to_change]
Update #tmp set id=[Newvalue]
Set Identity_Insert yourtable ON
Insert INTO yourtable (ID,col1,col2,....) Select * from #tmp
Set Identity_Insert yourtable OFF


-------------
http://baumannphoto.com" rel="nofollow - Blog | http://mpgtracker.com" rel="nofollow - MPG Tracker



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net