Groups | Blog | Home
all groups > sql server (alternate) > august 2003 >

sql server (alternate) : Why wouldn't this work?


Jeffrey Pratt
8/20/2003 5:10:40 PM
INSERT INTO AD_Account (AcctName, AcctAddress, AcctCity, AcctState, AcctZIP,
AcctStart, ListID)
VALUES ([AcctNameVal], [AcctAddressVal], [AcctCityVal], [AcctStateVal],
[AcctZIPVal], [AcctStartVal], [ListIDVal])

INSERT INTO AD_AcctContact (ContactFName, ContactLName, ContactTitle,
ContactTel, ContactEmail, ContactStart, AcctID)
VALUES ([ContactFNameVal], [ContactLNameVal], [ContactTitleVal],
[ContactTelVal], [ContactEmailVal], [AcctStartVal], @@IDENTITY)

Where everything in brackets is a properly typed value.

Gert-Jan Strik
8/21/2003 8:32:34 PM
This does work. If table AD_Account has an identity column, the value of
the newly created row will be available as a variable in the second
insert.

Gert-Jan


[quoted text, click to view]
AddThis Social Bookmark Button