Click here to Skip to main content
15,896,207 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

Hi guys
I want to make a store procedure which takes values
from two tables
table 1 is Items with
ItemID
Itemname
Quantity

table 2 is Staff with
StaffID
Lastname
Firstname
City
Address

I need all the staff to take all the items values
Posted
Comments
Wendelius 11-Jan-13 15:21pm    
So do you want to query from those tables in your procedure and return the data or do you want to send the data as parameters and then insert into the tables inside the procedure????
jomachi 11-Jan-13 15:22pm    
I want to send the data as parameters and then insert into the tables inside the procedure
jomachi 11-Jan-13 15:30pm    
Thanks I will test it

1 solution

To add into a table using a procedure you could have something like:
SQL
CREATE PROCEDURE AddItem 
    @ItemId integer, 
    @Itemname nvarchar(100),
    @Quantity integer
AS 
BEGIN
   INSERT INTO Items (ItemID, ItemName, Quantity)
   VALUES (@ItemID, @ItemName, @Quantity);
END;

For more information about the procedure creation, see CREATE PROCEDURE[^]
 
Share this 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