Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
PeterG
Posting Yak Master
156 Posts |
Posted - 2004-03-09 : 18:05:18
|
| I have this tableA:userid groupnumjoe 1lee 1sam 1ben 2dan 3kim 3len 4What I want to do is do a select on this table where groupnum=1 and insert the all rows returned into tableB (shown below) using one stored procedure.After the stored proc has executed tableB should look like this:tableBcomp cycledate userid groupnum file111 1/12/2003 joe 1 file1.xml111 1/12/2003 lee 1 file1.xml111 1/12/2003 sam 1 file1.xmlAll the other field values, except userid and groupnum, will be passed on to the stored proc when called by my vb.net application.I hope this makes sense. Thanks for your help. |
|
|
derrickleggett
Pointy Haired Yak DBA
4184 Posts |
Posted - 2004-03-09 : 18:24:49
|
| create procedure tableBInsert@comp varchar(5),@cycledate datetime,@file varchar(55)asinsert tableB( comp, cycledate, userid, groupnum, file) select @comp, @cycledate, ta.userid, ta.groupnum, @file from tableA ta where ta.groupnum = 1MeanOldDBAderrickleggett@hotmail.comWhen life gives you a lemon, fire the DBA. |
 |
|
|
|
|
|