I want to create a stored procedure which inserts some records from Archive table into the main table. 
My problem is that the client has multiple checkboxes in his grid and he/she can check any number of checkboxes. Each checkbox represents a record in the Archive table. Each record is identified by orderNo. On the basis of orderNo I want to make a Stored Procedure that takes a record from the Archive table and inserts this into the main table.
My question: How do I handle an unknown number of parameters in this Stored Procedure effectively? In pseudo-code:
create procedure moveRecords(what parameters i should take here)
as 
begin
insert into mainTable(orderNo,date,siteID) select orderNo,date,siteID from 
ArchiveTable where orderNo=<here what i write>
The client could send 1 parameter, 2, 3, 10, 20 parameter etc we don't know. Something like the following:
exec moveRecords(any no. of parameters)
I came up with a solution like the following:
- By putting all orderNo(sent by the client) into onetemp_Tableand retrieve these fromtemp_Tablein my Stored Procedure.
- At the server side we take all orderNoin an array and call procedure on the basis of this array.
I am looking for alternatives.
 
     
     
     
     
     
    