Identity column question

  • Thread starter Thread starter Mike Margerum
  • Start date Start date
M

Mike Margerum

I use an indentity column as the primary key in all of my SQL server
table. Do identity columns work ok in remote datasets? If im offline
and create an order/orderItems and i have the orderId's PK in my
items, how does it keep the linkage between the two when they all do
finally get their identity values on the server side?
 
Mike Margerum said:
I use an indentity column as the primary key in all of my SQL server
table. Do identity columns work ok in remote datasets?

Sure, they do very well. Just set your datatable pk column as autoincrement
with seed and step to -1 (so you won't have problems).

If im offline
and create an order/orderItems and i have the orderId's PK in my
items, how does it keep the linkage between the two when they all do
finally get their identity values on the server side?

The normal procedure is that once the insert is done, the real id is read
from sqlserver (SCOPE_IDENTITY) and datatable pk is updated with this value.
 
Back
Top