May 8, 2009 at 12:54 pm
Hi folks,
I need to add code to an existing dos batch file that will return one single row of data.
SQLCMD -E -d MyDBName -oMyDay.txt -Q "SET NOCOUNT ON SELECT SUBSTRING(Datename(dw, Max(BUSINESSDATE)),1,3) from MyDBName.dbo.Sales"
This returns :
----
Fri
How do I NOT return the '----' ???
Thanks in Advance !
john
May 13, 2009 at 6:14 am
Look up sqlcmd in Books Online.
The command line argument you're loking for is "-h" the value you should supply is -1.
ML
---
Matija Lah, SQL Server MVP
http://milambda.blogspot.com
May 13, 2009 at 7:56 am
Easy solution, thank you.
I did not know I could pass -1 and the documentation clearly states: Use -1 to specify that headers must not be printed.
May 13, 2009 at 9:43 am
Those darn manuals. They know everyting!
ML
---
Matija Lah, SQL Server MVP
http://milambda.blogspot.com
June 17, 2011 at 1:25 pm
Is there any way to keep header text, without the '-----------' line upon generation? Other than reopen the file and purge that line.
October 25, 2011 at 2:19 am
type C:\Scripts\Option2.txt | findstr /v \-\- > C:\Scripts\DestFile.csv
del C:\Scripts\Option2.txt
Viewing 6 posts - 1 through 6 (of 6 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