p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   SQL Server 2005 (http://p2p.wrox.com/forumdisplay.php?f=220)
-   -   Output Query to txt file from SQL Query (http://p2p.wrox.com/showthread.php?t=63364)

everest October 30th, 2007 05:17 PM

Output Query to txt file from SQL Query
 
i have a stored procedure that involves couple joins of tables. what i want now is to save the result in a text file programmatically so that i can schedule a job that runs this procedure. i looked in google but i could not find a solution.

any help is appreciated

Jeff Moden October 30th, 2007 06:30 PM

What kind of text file??? CSV??? Tab Delimited??? Fixed Field??? Quoted Literal???

--Jeff Moden

everest October 31st, 2007 07:58 PM

i am looking for tab delimited file.

Jeff Moden November 1st, 2007 07:34 AM

I just realized this is a 2k5 forum, not 2k... I don't know how to use SSIS...

BUT, I think 2k5 still has BCP and the equivelent to "xp_CmdShell" (although I'm pretty sure they call it something else). If you call BCP via a CmdShell call and use the QueryOut setting, you can even name the file you want to save to with a little dynamic SQL. See if you can find "BCP" in Books Online... make sure you read about all the different settings you can have. And, yes, it does have a couple of simple examples. It's a VERY powerful tool. The separator you're looking for is \t which means "tab".

--Jeff Moden

anujahnavi November 22nd, 2007 01:49 AM

How to configure sql server express stored procedures to execute xp_cmd shell.

want to use xp_cmdshell to save the result of a sqlserver expresss query to a text file.

Can any one help me out in this aspect.

Thanks & Regards
Anujahnavi S.


Quote:

quote:Originally posted by Jeff Moden
 I just realized this is a 2k5 forum, not 2k... I don't know how to use SSIS...

BUT, I think 2k5 still has BCP and the equivelent to "xp_CmdShell" (although I'm pretty sure they call it something else). If you call BCP via a CmdShell call and use the QueryOut setting, you can even name the file you want to save to with a little dynamic SQL. See if you can find "BCP" in Books Online... make sure you read about all the different settings you can have. And, yes, it does have a couple of simple examples. It's a VERY powerful tool. The separator you're looking for is \t which means "tab".

--Jeff Moden


All times are GMT -4. The time now is 09:23 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.