Solved

Generating Output Text File From SQL Server Stored Procedure

Posted on 2008-06-13
5
2,540 Views
Last Modified: 2010-04-21
Hello all!

I have a Stored Procedure that I use to generate a dataset that is subsequently used in a Crystal Report.
In order to track the data that is being processed, I'd like to generate an ouput file that would be created anytime the Stored Proecedure is run.  Ideally, I would like this Output Text file to just contain the one particular column of data from the dataset, but it can contain the entire dataset if necessary.

Now, I've read about using xp_cmdshell and OSQL as options of outputting text.  However,  this is a routine Client job that will be run on demand by a user without permissions to use commands like xp_cmdshell or OSQL.  Is there anything else I can try in order to facillitate this text file export?

Thanks in advance!
0
Comment
Question by:SpeedsterZ28
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 16

Expert Comment

by:brad2575
ID: 21780853
Could you not just save this output to a new table and save all the data into a field in the database?  If you know the fields have the fields seperated out or have one filed as a text or varchar(MAX) field contain all the data (depending on the amount of data we are talking about).

0
 

Author Comment

by:SpeedsterZ28
ID: 21781406
brad2575,

The issue is that we need to track the account numbers we pull in the report (which is the column of data I'd like to export to a file).  This is necessary so we can then upload the .txt file to our account management system which will automatically update the accounts from that list.

By just saving a list in another table of that data we pull, we'd eliminate the increased efficiency of the project by still requiring an associate to manually process the data set and enter notations for each account into our account management system.
0
 
LVL 16

Expert Comment

by:brad2575
ID: 21781419
Ok I misunderstood what the extra data/file was being used for.  I thought it was for history/tracking purposes.
0
 
LVL 13

Accepted Solution

by:
rickchild earned 250 total points
ID: 21783028
You could use BCP command to export to a text file, or you could set up a DTS which is then run by a Job.

BCP:  http://msdn.microsoft.com/en-us/library/aa174646(SQL.80).aspx
0
 

Author Closing Comment

by:SpeedsterZ28
ID: 31466998
DTS solved it for me.  Thank you!
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question