Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 12»»

SPOOLING Expand / Collapse
Author
Message
Posted Friday, May 31, 2002 1:20 PM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Friday, September 6, 2002 12:00 AM
Points: 52, Visits: 1

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
Post #4556
Posted Friday, May 31, 2002 2:52 PM
SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: Moderators
Last Login: Yesterday @ 9:16 AM
Points: 6,784, Visits: 1,895
You can redirect the output using osql and the ">" operator. There is also an option in QA to save to a file.

Andy
http://www.sqlservercentral.com/columnists/awarren/




Andy
SQLAndy - My Blog!
Connect with me on LinkedIn
Follow me on Twitter
Post #34759
Posted Monday, June 3, 2002 9:43 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Friday, September 6, 2002 12:00 AM
Points: 52, Visits: 1
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
Post #34760
Posted Monday, June 3, 2002 10:06 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Friday, September 6, 2002 12:00 AM
Points: 52, Visits: 1
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
Post #34761
Posted Monday, June 3, 2002 10:12 AM
SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: Moderators
Last Login: Yesterday @ 9:16 AM
Points: 6,784, Visits: 1,895
Confirmed that you have permissions to the folder?

Andy
http://www.sqlservercentral.com/columnists/awarren/




Andy
SQLAndy - My Blog!
Connect with me on LinkedIn
Follow me on Twitter
Post #34762
Posted Monday, June 3, 2002 10:27 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Friday, September 6, 2002 12:00 AM
Points: 52, Visits: 1
yeah i have all the permissions to the file. and I still get the error message

RICHARD KIRMSS



RICHARD KIRMSS
Post #34763
Posted Tuesday, June 4, 2002 7:29 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Friday, September 6, 2002 12:00 AM
Points: 52, Visits: 1
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
Post #34764
Posted Thursday, June 6, 2002 9:28 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Tuesday, December 10, 2002 12:00 AM
Points: 135, Visits: 1
hi, is de H; drive mapped with the sql server account?




Post #34765
Posted Friday, June 7, 2002 8:38 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Friday, September 6, 2002 12:00 AM
Points: 52, Visits: 1
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
Post #34766
Posted Friday, June 7, 2002 10:01 AM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: Administrators
Last Login: Today @ 7:12 AM
Points: 33,266, Visits: 15,432
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
steve@dkranch.net







Follow me on Twitter: @way0utwest

Forum Etiquette: How to post data/code on a forum to get the best help
Post #34767
« Prev Topic | Next Topic »

Add to briefcase 12»»

Permissions Expand / Collapse