Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
errrick
Starting Member
4 Posts |
Posted - 2009-12-30 : 16:22:49
|
Hi,
Is there a way I can setup a scheduled task that will run a specific SQL query (basically a SELECT statement) and automatically export the results to a file (that could be a CSV or whatever human readable/parser friendly format)
Note: SQL Server 6.5 is not reachable via remote access. All must be done in an NT4 system by connecting locally.
Thanks! Eric |
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
Transact Charlie
Master Smack Fu Yak Hacker
3451 Posts |
Posted - 2009-12-31 : 04:49:26
|
you could also just schedule a regular NT4 job with the AT command running the batch file but the method Tara illustrates is probably easier to keep track of as it's more logically tied to sqlserver.
Charlie =============================================================== Msg 3903, Level 16, State 1, Line 1736 The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION |
 |
|
errrick
Starting Member
4 Posts |
Posted - 2010-01-04 : 08:10:40
|
Thanks Tara / Charlie, will try that. I thought that bcp.exe didn't even exist in 6.5 :p |
 |
|
errrick
Starting Member
4 Posts |
Posted - 2010-01-04 : 10:24:14
|
I just found that BCP in SQL 6.5 does not allow to run custom queries, it can only export tables (it doesn't even let me select which columns I want!)
Is there any other approach? |
 |
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
errrick
Starting Member
4 Posts |
Posted - 2010-01-04 : 13:47:54
|
Tara, bcp.exe in SQL 6.5 does not have the queryout option. However I figured out the View solution already.. it seems to do what I want, thanks! |
 |
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
|
|