View Single Post
  #1 (permalink)  
Old December 31st, 2007, 10:57 AM
kumiko kumiko is offline
Authorized User
Join Date: Aug 2006
Location: , , .
Posts: 65
Thanks: 0
Thanked 0 Times in 0 Posts
Default Create Store Procedure ??

halo there...happy new year..i need some help on the store procedure in MS SQL,i m quite new in SP..i cant find any example of tutorial on it..
i have two tables, that is table A and table B. and i got 10 records from the form need to insert into the seperate field for table A and B.
ok..wat i wan to do is:

1) : i need to select the max order number from table A. mean i have to select the last order number from the table A. let say, the last order number is 1000, then the new order number will be 1001( ordernum =ordernum+1)
2) GET the ordernumber and the 5 records from the form and then insert into the field for TABLE A.

3) then, SELECt the MAX ORDER ID from the table A(which is the PK) and then set as the variable.
4) Insert the MAX order ID into the table B with the other field records..

plz help..i duno how to write a SP about this..plz help...thanx