December 25, 2002 at 1:19 pm
I need to have an way to automatically submit a sql query in Sql 2000 - the query joins several lables and exports the info to a file. Right now I've been doing it interactively in Query analyzer and
using the export to option... I can't use DTS (query way too complicated!) and the file created is >255 lrecl so that seems to be a big problem too!
Any suggestions? Save me from this same predicament on New Years Day!
Thanks and Happy Holidays!
December 25, 2002 at 3:12 pm
Maybe this will help. Your problem is really two parts, one is running the query, the other is exporting the results. For the first part you could run the query and put the results into a table, then for the second part use DTS (or VB, etc) to connect to the table and export it one row at a time.
Andy
December 25, 2002 at 4:22 pm
Happy holidays and I'd vote for Andy's solution. Much simpler to do.
Steve Jones
December 25, 2002 at 4:24 pm
Thanks! You guys are HEROS! (right up there with Santa!)
Happy Holidays!
December 26, 2002 at 7:56 am
Looks like you already have a solution. OSQL could have also been used to execute the query, and write the output to a file. OSQL could be run from a SQL Agent job.
Gregory Larsen, DBA
If you looking for SQL Server Examples check out my website at http://www.geocities.com/sqlserverexamples
Gregory A. Larsen, MVP
December 26, 2002 at 7:57 am
Forgot to ADD OSQL could be executed via xp_cmdshell, via a SQL Agent job.
Gregory Larsen, DBA
If you looking for SQL Server Examples check out my website at http://www.geocities.com/sqlserverexamples
Gregory A. Larsen, MVP
Viewing 6 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply