Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Retro-fit an identity column
Message
From
20/09/2000 10:54:59
 
 
General information
Forum:
Microsoft SQL Server
Category:
Import/Export
Miscellaneous
Thread ID:
00418151
Message ID:
00418534
Views:
27
>If the a large VFP data with compound key have already been upsized and now resides in MSSQL but I want to create a new Identity column to use as primary key how can I assign the values for existing records? In VFP I could issue something like:
>
>REPLACE ALL newcolumn WITH RECNO()

Try...

declare @NewKey INT
set @NewKey = 1

UPDATE MyTable
SET NewField = @NewKey
,@NewKey = @NeyKey + 1

BOb
Previous
Reply
Map
View

Click here to load this message in the networking platform