SQL 7.0
I have a form in ASP.NET and I want to write the values to the SQL
Server tables.
The tables are Customer and Address tables.
There will be an insert into the Customer table, and I need to use the
Identity of this inserted record for the Foreign Key in the Address
table insert.
For example
INSERT INTO Customer (CustomerName)
VALUES (@CustomerName)
Select @@identity as CustomerID
INSERT INTO Address (Address, CustomerID)
VALUES (@Address, CustomerID)
My question is this. If I put this into a single stored procedure can
I absolutely GUARANTEE that the @@identity value will be from the
Customer table insert, or could it feasibly be from another, as it
were, colliding operation?
TIA
Edward
--
The reading group's reading group:
I have a form in ASP.NET and I want to write the values to the SQL
Server tables.
The tables are Customer and Address tables.
There will be an insert into the Customer table, and I need to use the
Identity of this inserted record for the Foreign Key in the Address
table insert.
For example
INSERT INTO Customer (CustomerName)
VALUES (@CustomerName)
Select @@identity as CustomerID
INSERT INTO Address (Address, CustomerID)
VALUES (@Address, CustomerID)
My question is this. If I put this into a single stored procedure can
I absolutely GUARANTEE that the @@identity value will be from the
Customer table insert, or could it feasibly be from another, as it
were, colliding operation?
TIA
Edward
--
The reading group's reading group:
Comment