Walter Tucholski
Ten Centuries
Points: 1262
More actions
March 2, 2006 at 10:57 am
#96669
I need to create and export a csv file from an sql server table within a stored procedure. Help!!
alonzo
SSC-Addicted
Points: 443
March 3, 2006 at 6:41 am
#624582
An easy way is to create a DTS package that exports the file or table in csv format then call it inside your stored procedure like:
exec master..xp_cmdshell 'dtsrun /S "ServerName" /U "UserName" /P "Password" /N "PackageName"'
David Burrows
SSC Guru
Points: 65142
March 3, 2006 at 7:24 am
#624604
or use BCP
exec master..xp_cmdshell 'bcp database.owner.tablename out outputfilename -c -t "," -S servername -T'
Far away is close at hand in the images of elsewhere.Anon.
tsage
Grasshopper
Points: 19
April 8, 2008 at 5:33 pm
#800069
Hello,
This works, but I get character zero in null fields. Is there a way to eliminate these?
Thanks
Tom
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply