Tuesday, November 17, 2009

Insert Data into Multiple Tables

DECLARE @ID int
INSERT INTO Customers
(FirstName, LastName)
VALUES ('Sheeban', 'Ahmed')
SET @ID = SCOPE_IDENTITY()
INSERT INTO Orders
(CustomerID, OrderName, Quantity)
VALUES (@ID,'IPhone',100)

No comments:

Post a Comment