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 2005 Forums
 SQL Server Administration (2005)
 osql messy messy output

Author  Topic 

DeepSeed
Yak Posting Veteran

52 Posts

Posted - 2010-07-09 : 17:25:14
Hello,

I am running a simple count statement via osql, the text file it creates is a mess. I can clean up spaces and tabs but it has tons of other characters.

I don't want 1> 2> 3> or -------- or anything, just one number, the count result.

I tried SET NOCOUNT ON which cleaned up some stuff, and -s -h-1 and so on.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-07-09 : 17:45:42
Use sqlcmd instead. osql is provided for backwards compatibility of 2000 and lower. For 2005 and higher, you should instead use sqlcmd.

sqlcmd doesn't have the issue you are experiencing.

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

Subscribe to my blog
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2010-07-09 : 17:48:18
If you can't use sqlcmd for some reason, the -n flag will remove those numbers.
Go to Top of Page

DeepSeed
Yak Posting Veteran

52 Posts

Posted - 2010-07-09 : 17:48:46
Ok I switched to sqlcmd, now the 1> 2> and such are gone but still getting -------------
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-07-09 : 17:55:54
Try Rob's suggestion along with sqlcmd.

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

Subscribe to my blog
Go to Top of Page

DeepSeed
Yak Posting Veteran

52 Posts

Posted - 2010-07-09 : 17:59:12
no go, but replacing dashes with "" is easy, so now I can clean it up. The 1> 2> where a pain, thanks!
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-07-09 : 18:11:42
You're welcome, glad to help.

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

Subscribe to my blog
Go to Top of Page
   

- Advertisement -