Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 UNLOAD

Author  Topic 

dwdwonw
Starting Member

21 Posts

Posted - 2011-10-19 : 14:31:22
Can I use an UNLOAD command in MSSQL to send query results to a file? Or, is there a similar command I can use (I came from R:BASE).

My objective is to unload the data without the header row. The environment I am forced to work in has an Export button that sends the data out to a csv file, but does not let me control whether or not the header row is sent out (it is always sent). Therefore, am looking for a work around.

Thanks,
Dan

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-10-19 : 14:32:28
You can easily "unload" the data to a file using bcp.exe, which is a command-line tool. Bcp.exe does not include the header row unless you work some magic to add it, so this should be perfect for you.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

dwdwone
Yak Posting Veteran

71 Posts

Posted - 2011-10-20 : 11:54:24
They won't let me do it. I am limited to what our software vendor lets us do.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-10-20 : 12:26:30
So then you'll need to tell us what your software vendor lets you do. Bcp.exe comes with SQL Server, if they won't let you use that, well I'd think twice about their product.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-10-20 : 12:26:46
Why are you using two accounts?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

dwdwone
Yak Posting Veteran

71 Posts

Posted - 2011-10-20 : 12:40:58
I had a typo on one of them and wasn't able to log in because I didn't know my user id. So, I created a new account.

Apparently I was still logged in on another computer, so ended up with two (as it did not ask me for a log in). I really only need one!
Go to Top of Page
   

- Advertisement -