Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

@identity to get last entered id from another table

Status
Not open for further replies.

696796

Programmer
Aug 3, 2004
218
GB
Can i do this sql statement?

Code:
sql2 = "INSERT INTO tblmaterialSupplier (materialId, SupplierID) values (SELECT @identity FROM tblmaterials, '" & intSuppId & "')"

I can't get this sql to work - i need to get the last enetered materialId from my materials table...

Alex
 
You have to actually insert it to get an @identity. Do the insert, then return the @scope_identity()

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top