Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sql Table create Set Identity_seed
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01530458
Message ID:
01530616
Views:
50
>Hi Borislav.
>Say I do that, and my Identity filed ends up as follows (No duplicates but not necessarily in sequence)
>100
>303
>20000
>300
>
There is no need to be not in sequence . SQL Server handles it.


>What will Sql assign as the next identity ?
>Is it clever enough to look at the 'Highest' entry and just add 1
>if it does this, I am home and dry and dont need to do anything.
>if however, it say creates 301 (1 greater than the last row) at some point there is going to be a clash with the exisitng 303
>
>Regards,
>Gerard
>
>
>>>>I have a VFP program to copy over VFP tables into exisitng SQL Server Table
>>>>The SQL SErver table has an Identity with an Identity Seed
>>>>How do I : Set Identity_Insert off,and after I have imported the data, set Identity_Insert on and also set the Identity Seed to a new number
>>>>
>>>>I think I can set the Identity Insert by putting following into a string:
>>>>SET IDENTITY_INSERT MYTABLE OFF
>>>>IMport the VFP data
>>>>SET IDENTITY_INSERT MYTABLE ON
>>>>
>>>>Not so sure how to set the seed though ?
>>>>
>>>>Tia
>>>>Gerard
>>
>>
>>As I said, there is no need to do anything with the seed.
>>Just do:
>>
>>SET IDENTITY_INSERT YoruTable OFF
>>--- Do the Insert and make sure you didn't insert duplicated values
>>SET IDENTITY_INSERT YoruTable ON
>>
>>That is all.
>>SQL Server will handle the re-seed of the column.
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform