Using a stored procedure that takes input parameters, I would like to do the following:
Insert into table1(datetimestamp, seqno, loc, val) VALUES
(@datetimestamp, 1, @loc1, @val1)
Insert into table1(datetimestamp, seqno,loc, val) VALUES
(@datetimestamp, 2, @loc2, @val2)
Insert into table1(datetimestamp, seqno, loc, val) VALUES
(@datetimestamp, 3, @loc3, @val3)
.
.
.
where @datetimestamp, @loc1, @loc2, @loc3, @val1, @val2, @val3 are input values to the stored procedure.
I would like to create a loop within the stored procedure so that I dont have to write individual insert statements. I have tried using the exec() command but have not been successful with the correct syntax.
Please help. thanks.
Jay
Insert into table1(datetimestamp, seqno, loc, val) VALUES
(@datetimestamp, 1, @loc1, @val1)
Insert into table1(datetimestamp, seqno,loc, val) VALUES
(@datetimestamp, 2, @loc2, @val2)
Insert into table1(datetimestamp, seqno, loc, val) VALUES
(@datetimestamp, 3, @loc3, @val3)
.
.
.
where @datetimestamp, @loc1, @loc2, @loc3, @val1, @val2, @val3 are input values to the stored procedure.
I would like to create a loop within the stored procedure so that I dont have to write individual insert statements. I have tried using the exec() command but have not been successful with the correct syntax.
Please help. thanks.
Jay