Print Command in a trigger

  • I'm trying to do a simple print command in a trigger, and it's completely skipping over it. I'm not getting any errors, and it's not printing the message either. I'm trying to print the number of records inserted with this command:

    Declare @InsertedCountInt

    Set @InsertedCount = (Select Count(*) From inserted)

    Print @InsertedCount

    What am I doing wrong? I know that records are being inserted because other code in the trigger is working fine. I'm trying to debug one piece of code that isn't working, and I really need that print command to work.

    Thanks!

  • Try writing the info out to a table instead.

    Andy

  • print doesn't work in triggers,

    insert it into a table like andy said.

  • Thank you so much. This is new to me. I had successfully printed from stored procedures, but I had no idea it wasn't available in triggers.

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

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