http://www.4guysfromrolla.com/webtech/062899-1.shtml<BR><BR>I want to make this thing dynamic.. meaning it should accept the SQL Query as the third parameter instead of including it in this proc itself. so other procs will call this common proc. besides the required records i also want to return total records inserted in the temp table and the total number of pages as the nextrecordset. i have reached quite near to it. what is left out is just the PAGECOUNT. can anyone help me. i can paste the proc that i have made if you want to go thru.