May 31, 2002 at 1:20 pm
I was wondering if any one could help me out. I'm trying to spool the results from a tsql script to a text file. I'm haveing trouble finding a way to do this. Please if you know how to do this please help me.
rich
RICHARD KIRMSS
RICHARD KIRMSS
May 31, 2002 at 2:52 pm
You can redirect the output using osql and the ">" operator. There is also an option in QA to save to a file.
Andy
June 3, 2002 at 9:43 am
i'm trying to run this simple test script using the osql utility
exec master..xp_cmdshell 'osql -Q"select * from %syslogins..master%" -oH:\testfile\stats.txt'
and i'm getting this error message
cannot open output file
no such file or directory.
- I have created the file and I still get the same error.
any ideas?
thanks rich
RICHARD KIRMSS
RICHARD KIRMSS
June 3, 2002 at 10:06 am
I'm sorry i gave the query it is suppost to be select * from master..sysobjects.
i'm still getting the same error however.
rich
RICHARD KIRMSS
RICHARD KIRMSS
June 3, 2002 at 10:12 am
Confirmed that you have permissions to the folder?
Andy
June 3, 2002 at 10:27 am
yeah i have all the permissions to the file. and I still get the error message
RICHARD KIRMSS
RICHARD KIRMSS
June 4, 2002 at 7:29 am
ok i've checked the permissions on the file that i'm trying to write to, and I'm still coming up with the same error. Any idea on what I might be doing wrong?
thanks rich
RICHARD KIRMSS
RICHARD KIRMSS
June 6, 2002 at 9:28 am
hi, is de H; drive mapped with the sql server account?
June 7, 2002 at 8:38 am
ok i've figured out the problem I wasn't specifiying the full server name. Thank you for your help. I have one more question however. I was noticing that when you pipe the output of the query to a file the last statement is the the only one to get piped to the output. I was wondering if there is a way to append other output to the file that you are piping to.
Thank you once again,
Rich
RICHARD KIRMSS
RICHARD KIRMSS
June 7, 2002 at 10:01 am
osql .... > filename
is a new file.
osql ... >> filename
appends to the file. See my series on version control, part 3 for more info.
Steve Jones
June 7, 2002 at 10:08 am
Steve,
Thank you very much I over looked the double ">".
Rich
RICHARD KIRMSS
RICHARD KIRMSS
Viewing 11 posts - 1 through 10 (of 10 total)
You must be logged in to reply to this topic. Login to reply