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
 Import/Export (DTS) and Replication (2000)
 Text File using OSQL, BCP

Author  Topic 

andy8979
Starting Member

36 Posts

Posted - 2005-09-28 : 03:54:12
Hi Guys,
I tried the osql utility to generate an output text file the text file is generating properly but it gives an extra row in the last record which is blank row (a new line character).
I even tried the BCP utility but I got the same output.

Is there any option to remove the last blank record ( new line character)

I used the following OSQL command:
osql -Sserver -Uusername -Ppass -ddbname -Q"select * from employees" -o"c:\output.txt" -h-1 -w 8100

Please help me out.
Thanks in Advance.



Anuj.

andy8979
Starting Member

36 Posts

Posted - 2005-09-28 : 05:13:13
Found the Solution:

osql -Sserver -Uusername -Ppassword -ddbname -Q"Select * from employees" -h-1 -w 8100 -n -b | findstr /V /r /c:"^$" > "C:\output.txt"

This statement works fine good solution.

Anuj.
Go to Top of Page
   

- Advertisement -