• Jeff Moden (7/26/2013)


    Using PRINT for troubleshooting can be a real PITA and the output sometimes doesn't show up until the end of the run instead of as the procedure run unfolds.

    I recommend that you learn how to use RAISERROR with a "severity" of "0" and the WITH NOWAIT option. Then, add an optional parameter to the proc called @MessageLevel and use IF in the proc to decide whether to execute the RAISERROR based on the value of @MessageLevel.

    Thanks for this advise, I'll use this in the future were this is appropriate.

    But the problem remains no variables can be added.

    RAISERROR ('Now that''s what I call a message!'+convert(varchar(30),getdate(),126), 0, 1) WITH NOWAIT

    Does not work.

    Offcourse I could first build the string in a variable and pass that. But that would slow down my work and make the code larger and less clear.

    Thanks for the advise,

    Ben