Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Remote View set identity_insert on
Message
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Remote View set identity_insert on
Divers
Thread ID:
00839334
Message ID:
00839334
Vues:
179
I am using remote views to update data in an sql server database. This is all good. My problem is:

One thing I'm doing is using VFP as a meta data tool in order to affect structure changes on a sql server database. When I determine that a table needs a stucture change, I do the following:

1. Execute and SQLEXEC that pulls the records from SQL Server into a VFP cursor
2. DROP and CREATE the SQL Server table
3. Create a remote view that connects to the new SQL Server table
4. Append the records from the cursor (that was holding the data) into my remote view
5. Issue tableupdate()

This is all beatiful except:
I use identity columns on my sql server database. If there are deleted records in my sql server database, when the data gets appended into my remote view and then updated to SQL Server, SQL Server "renumbers" my identity column because I created a new table.

Thus, I lose the missing ids, which then breaks relationships, etc, etc.

Does anyone know how I might SET IDENTITY_INSERT ON inside of the connection that SQL Server is working with. Or, does anyone have a better way to do this?

Dave
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform