Information générale
Catégorie:
Codage, syntaxe et commandes
Hi Guys. Thanks for replying.
Yes, I realse that SQL server inserts the seed itself, but I am importing data here.
Scenario is:
1. In a VFP Table, I have a Field which a special .prg inserted the value, a sequential generator piece of code.
2. As other tables are linked using this key, I need to keep it, whatever it is after the move to SQL
(Mostly will be sequential ,but there may be lots of Gaps due to historical reasons)
3. When I Import it, I need to keep the value in this field, but after I import it, I want to use the Sql Server Identity type
for Sql to generate the keys itself
My way of handling this was:
a) Set the Identity fscility off
b) Import the table from VFP to SQL (Idnetity key will not be generated)
c) Turn back on identity , with a seed higher than the highest value (So Sql will start dishing out the Identity)
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
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement