Eric Creese wrote: > This is a very simple question. > > I need to do this in SQL Server from a job not a CF page. > > I have a table where I store customer IDs. I want to pull the individual IDs and > loop each ID out of the table and run it against another query and write that output > of the query to a tmpTable. How do I do this and if you could help it would be most > appreciated.
Can't you just do: INSERT INTO temptable (field [, field]) SELECT field [, field] FROM othertable WHERE id IN (SELECT id FROM customertable) Why do you want to loop? Jochem ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Signup for the Fusion Authority news alert and keep up with the latest news in ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4