Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Adding a row to a table and delay setting PK
Message
From
09/03/2018 11:36:56
 
General information
Forum:
Microsoft SQL Server
Category:
Database design
Miscellaneous
Thread ID:
01658640
Message ID:
01658646
Views:
42
>A table in SQL Server has a PK column, Identity. I would like to be able to add a row/record to the table without actually setting the value in the PK column, until the VFP 9 application saves the row/record. I think the only way to do it is to be able to "get" the next PK value (Identity) without actually adding a row. Then, then user Saves the record, add new row. But then (as I type it, I realize) the PK column will get a new Identity value.
>
>Is something like I am describing above possible?

A primary key with Identity definition will auto generate the value by itself. As soon as you insert a new row, that field is populated automatically by SQL Server. That is the best approach to use. There used to be a time when we had to use our own routines to generate such key. I haven't heard of that being done manually since years now.
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform