Results 1 to 3 of 3

Thread: OSQL Query Output

  1. #1
    Join Date
    Mar 2006
    Posts
    127

    OSQL Query Output

    Hi All,

    The command showed below provides the output shown:

    set @cmd = 'osql -S bcgsql1\bcgsqldev -U checkdb -P checkdb -q "set nocount on; select errorlogdesc from ##errors where datediff(dd,errorlogdatetime,getdate()) = 1 and errorlogdesc like ''%Error:%''" -h-1 -w 900 -o J:\Scripts\TestStuff\ErrorLogMsg.txt'


    Here is the output:

    Error: 17883, Severity: 1, State: 0




    Error: 17883, Severity: 1, State: 0


    I need to remove the space between the two lines so I set the -w parameter to 900 but that didn't fix it. Any idea how I can accomplish this?

    Thanks

  2. #2
    Join Date
    Nov 2002
    Location
    New Jersey, USA
    Posts
    3,932
    Did you try RTRIM

    set @cmd = 'osql -S bcgsql1\bcgsqldev -U checkdb -P checkdb -q "set nocount on; select RTRIM(errorlogdesc) from ##errors where datediff(dd,errorlogdatetime,getdate()) = 1 and errorlogdesc like ''%Error:%''" -h-1 -w 900 -o J:\Scripts\TestStuff\ErrorLogMsg.txt'

  3. #3
    Join Date
    Mar 2006
    Posts
    127
    Thank you very much. It worked.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •