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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 OSQL header issue

Author  Topic 

rgp060374
Starting Member

4 Posts

Posted - 2004-10-22 : 08:51:27
Hi,

How can I get rid of the second line of the header when using osql. I want the column names but not the line containing the '----------' characters.

My osql looks as follows:
osql /U user /P password /d db /S server /i C:\SQL_File.sql /o C:\SQL_File.csv -s , -n -w 2000

Thanks.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-10-22 : 13:23:44
Show us SQL_File.sql.

Tara
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2004-10-22 : 17:49:56
You can use the "findstr" command-line utility to clean up the output file.

Findstr has a switch (/V) to display lines that DO NOT contain the string you're searching for. You can then redirect the output from Findstr into another text file. The following should do the trick:

findstr /V "------" C:\SQLFile.csv >C:\SQLFileNoSeparator.csv

You need to start a command prompt and paste the above into the command line. When you run it, it will create a 2nd file called SQLFileNoSeparator.csv that will contain everything but the line containing the "-----" characters.
Go to Top of Page

rgp060374
Starting Member

4 Posts

Posted - 2004-10-25 : 09:53:46
Thanks robvolk
Go to Top of Page
   

- Advertisement -