Stored Procedures

Results 1 to 3 of 3

Thread: Stored Procedures

  1. #1
    Jenny Guest

    Default Stored Procedures

    I need to read through a table row by row in a stored procedure.<BR><BR>This is my code ....<BR><BR>Select @Max=Max(MsgID)from tbloutbound<BR>Set @Counter=0<BR>While @Counter &#060; @Max<BR> &#039Now I need to read through tblOutBound row by row.<BR> &#039Insert the data that I&#039ve just retrieved into another table<BR> &#039proceed through loop<BR><BR>I thought it would have been something like<BR>Select @DD=Description from tbloutbound where RowCount=@Counter<BR><BR>Please help ....<BR><BR>Thanks, Jenny<BR><BR><BR><BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Stored Procedures

    It seems like there may be an easier solution. It sounds like what you&#039re trying to do is insert a number of records from one table into another. Say you had Table1, with Name, Age, and Sex as three fields. Table2 might have Name, Age, Sex, MaritalStatus, Address. If you wanted to move all the rows from Table2 to Table1, you could do:<BR><BR>INSERT INTO Table1 (Name, Age, Sex)<BR>SELECT Name, Age, Sex FROM Table2<BR><BR>Is this what you&#039re trying to do?

  3. #3
    Ricardo Londe Guest

    Default RE: Stored Procedures

    Try it: <BR><BR>Create Procedure MoveData AS<BR>Insert INTO anotherTable <BR> Select * from tbloutbound<BR>GO<BR><BR>I hope this helps.<BR>Ricardo Londe<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts