January 8, 2009 at 11:52 am
I need to export data to a text file within a Stored Procedure.
The file name and location is always the same.
The text file needs to be replaced with the new result set.
I do not know C# or VB.NET, so CLR may not be an option for me.
Currently, I use the following command. However, we are eliminating xp_cmdshell.
EXEC master..xp_cmdshell 'bcp "SELECT * FROM tblTable" queryout \\Server\Folder\FileName.txt -T -c'
Thank you very much!
January 8, 2009 at 11:53 am
Use SSIS
January 8, 2009 at 12:23 pm
Elaborating on Ray's reply...
You could create an SSIS Package and then you could call that from the stored procedure, by various means... using XP_Cmdshell, usign TSQL to add it to a job in the SQL Agent que etc.
There are various articles on the very subject on this site. Another reference you could use would be BOL or SQLdts.com
-Luke.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply