Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi I'm currently learning T-SQL but I cant seem to find how create a store procedure, Im trying to

INSERT INTO ProductTable ( ProductID , ProductName , ProductColor , ProductPrice , ProductMarkUp)
VAlUES( @ProductID, @ProductName, @ProductName, @ProductColor, @PRoductPrice, @ProductMarkUp)
SET @ProductID = ProductDetailsID
BEGIN
INSERT INTO ProductDetails (SupplierName, SupplierCountry, Quantity, UnitSold, CostPrice, ProductDetailsID)
VALUES(@SupplierName, @SupplierCountry, @Quantity, @UnitSold, @CostPrice , @ProductDetailsID)


How cant I altenatively acheive this.Thank you
Posted
Updated 26-Jul-11 22:18pm
v2

SQL
Create Proc InsertIntoMultipleTables
(
   @Parameter1 Type,
   @Parameter2 Type,
   @Parameter3 Type
)

AS

Begin

insert into table1 (Col1, Col2) values (@Parameter1, @Parameter2)

insert into table2 (Col1, Col2) values (@Parameter1, @Parameter3)

End


Enjoy...
Nitin Verma
 
Share this answer
 
v2
Comments
Reiss 27-Jul-11 4:30am    
Orginally you had some syntactical errors, but essentially was correct
This[^] will help you to get started.
 
Share this answer
 
Comments
Manas Bhardwaj 27-Jul-11 4:26am    
agree, +5. I tried to understand the queries but gave up.
Reiss 27-Jul-11 4:32am    
Good link - leading people to find their own solution and therefore increasing their understanding is better than just spoon feeding them the answer.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900