July 17, 2007 at 8:31 am
I'm having a brain freeze day, how can I export data from a SQL 2000 table without having the column headings on the .TXT file?
Is BCP the answer or can it be done in T-SQL.
Thanks ahead of time for any help.
July 17, 2007 at 8:49 am
I'm using 2005 but I'm pretty sure the same applies to 2000 if my memory serves me well.
Click on "Query" on you menu bar and there should be a Query options section and under the section where you choose how you want your results I.E grid text file etc I'm pretty sure you can say no headers
----------------------------------------------
Try to learn something about everything and everything about something. - Thomas Henry Huxley
:w00t:
Posting Best Practices[/url]
Numbers / Tally Tables[/url]
July 17, 2007 at 9:06 am
This worked great, I found the options, any idea how to set them in a SQL proc?
July 17, 2007 at 9:11 am
have you tried using the osql command in .BAT file?
I'm suer hwo you going to be running your proc.
If you can run it from a .BAT file or a dos prompt then it may help:
http://www.di-mgt.com.au/osqlUtility.htm
----------------------------------------------
Try to learn something about everything and everything about something. - Thomas Henry Huxley
:w00t:
Posting Best Practices[/url]
Numbers / Tally Tables[/url]
July 17, 2007 at 9:26 am
As Christoper suggests, you may want to create the report (in T-SQL, possible as a sproc) and have OSQL run it... to suppress the headers, use the -h-1 parameter in the call to OSQL. If you're allowed to use xp_CmdShell, you can call OSQL from the T-SQL using a trusted connection.
--Jeff Moden
Change is inevitable... Change for the better is not.
July 17, 2007 at 9:28 am
And, yes... BCP will also create output without headers.
--Jeff Moden
Change is inevitable... Change for the better is not.
July 17, 2007 at 10:05 am
It looks like the only way to do this with osql is to do the following:
osql -E -d pubs -q "select * from dbo.authors" >junk.txt -h-1
then I write a VB script to delete the last line because it has the format (23 rows affected)
If there are any other suggestions, let me know; I'll also try the BCP option.
July 17, 2007 at 11:07 am
No, no... just add SET NOCOUNT ON...
osql -E -d pubs -q "SET NOCOUNT ON select * from dbo.authors" >junk.txt -h-1
You could also do it in a file using the -i parameter and you could also execute a stored proc. But, the SET NOCOUNT ON thing will eliminate the need of that VB script...
--Jeff Moden
Change is inevitable... Change for the better is not.
July 17, 2007 at 11:21 am
thanks so much
Viewing 9 posts - 1 through 9 (of 9 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy