Suppress empty space in results

  • Good afternnon,

    I am executing a stored procedure using OSQL and outputing the results to a text file.  One of the result columns is sysjobs.name from msdb. 

    The problem is sysjobs.name is 128 characters long.  Even if the name of the job is "job1" I get 128 dashes in the result header.  If I use the osql switch to suppress headers I still get the full 128 spaces.

    Can this be prevented?

    Thanks

    Jonathan

  • Not directly.

    You can try to convert the column to a lower size, like this:

    SELECT CONVERT(VARCHAR(30), name) AS name FROM msdb.dbo.sysjobs

    But it will cut the names larger that the size you specify.

  • Worked perfectly!  I have control over job names so not concerned about length.

    Thanks a million!

    Jonathan

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply