I am having a problem with the exec command in t-sql. I am trying to create a stored proc to handle being able to grab only certain rows from a table, currently there are 85000 records and i would only like to have 1000 at a time so instead of loading them all into cf and then telling cf what rows i want i have a stored proc. here is the sp
DECLARE @myquery varchar(500) SET @myquery = 'SELECT tempsupportid=IDENTITY(INT),* INTO #tempsupport FROM supporters_email ' + @QueryVal + ' ORDER BY ' + @Orderby EXECUTE(@myquery) SELECT * FROM #tempsupport WHERE tempsupportid BETWEEN @startrow AND @endrow DROP TABLE #tempsupport The problem with this is that anything executed in the the EXECUTE method does not remain afterwards, but i need to dynamically build the query so that I can specify the where statment and the order by from cf. so basically i need a way to dynamically execute a query and have it remain afterward till the end of the session at least. ______________________________________________________________________ This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/[email protected]/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

