Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2005 > SQL Server 2005
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
SQL Server 2005 General discussion of SQL Server *2005* version only.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2005 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 30th, 2007, 05:17 PM
Authorized User
 
Join Date: Mar 2004
Location: , , .
Posts: 74
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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
Reply With Quote
  #2 (permalink)  
Old October 30th, 2007, 06:30 PM
Friend of Wrox
Points: 1,536, Level: 15
Points: 1,536, Level: 15 Points: 1,536, Level: 15 Points: 1,536, Level: 15
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2006
Location: , MI, USA.
Posts: 475
Thanks: 0
Thanked 9 Times in 9 Posts
Default

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

--Jeff Moden
Reply With Quote
  #3 (permalink)  
Old October 31st, 2007, 07:58 PM
Authorized User
 
Join Date: Mar 2004
Location: , , .
Posts: 74
Thanks: 0
Thanked 0 Times in 0 Posts
Default

i am looking for tab delimited file.
Reply With Quote
  #4 (permalink)  
Old November 1st, 2007, 07:34 AM
Friend of Wrox
Points: 1,536, Level: 15
Points: 1,536, Level: 15 Points: 1,536, Level: 15 Points: 1,536, Level: 15
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2006
Location: , MI, USA.
Posts: 475
Thanks: 0
Thanked 9 Times in 9 Posts
Default

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
Reply With Quote
  #5 (permalink)  
Old November 22nd, 2007, 01:49 AM
Registered User
 
Join Date: Nov 2007
Location: hyderabad, andhrapradesh, India.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
SQL Query output to XML using BCP HELP!! miamikk SQL Language 3 May 15th, 2009 08:22 AM
Sql query output to XML or HTML file miamikk SQL Language 4 June 6th, 2007 03:58 AM
How to output dataset to .txt file not to .xml? nesrine C# 1 March 8th, 2007 11:34 AM
Cannot display/return SQL Query Output from a Vari sjm SQL Server DTS 1 September 9th, 2005 11:40 AM
Disassembler (output on .txt file) gettipu J2EE 0 February 20th, 2005 03:19 PM



All times are GMT -4. The time now is 12:22 AM.


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