How to print blank lines in the Job's Output Text File using TSQL.

  • We are running SQL Server 2005 SP3 on Windows Server 2003. I have some TSQL set up to run within a job. I put comments within the TSQL, see below:

    PRINT ''

    PRINT '************************************************'

    PRINT '* BEFORE BB_BB60 BACKUP:'

    PRINT '************************************************'

    PRINT ''

    PRINT ' '

    PRINT ' '

    PRINT ' '

    GO

    DECLARE @TimeStamp char(17)

    SET @TimeStamp = (SELECT REPLACE(CONVERT(varchar(10),getdate(),112),'/','')) + (SELECT REPLACE(CONVERT(varchar(12),getdate(),108),':',''))

    DECLARE @FileName char(75)

    SET @FileName = 'd:\CCPS Database Maintenance\Backups\Weekly\bb_bb60_before_' + Substring(@TimeStamp,1,12) + '.bak'

    BACKUP DATABASE bb_bb60 TO

    DISK= @FileName

    GO

    I am trying to get blank lines to print within the Job's Output Text File by using the various Print Statements. The Job's Output Text File does not show the blank lines. When I run the code from a new query window the blank lines are displayed in the query output window.

    How may I get blank lines to print in the Job's Output Text File?

    Thanks in advance, Kevin

  • Try carriage returns/line feeds.....

    SELECT '' + CHAR(13) + CHAR(10)

    + '************************************************' + CHAR(13) + CHAR(10)

    + '* BEFORE BB_BB60 BACKUP:' + CHAR(13) + CHAR(10)

    + '************************************************' + CHAR(13) + CHAR(10)

    + CHAR(13) + CHAR(10)

    + CHAR(13) + CHAR(10)

    + 'END'

    John Rowan

    ======================================================
    ======================================================
    Forum Etiquette: How to post data/code on a forum to get the best help[/url] - by Jeff Moden

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

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