Why does the PRINT statement in T-SQL seem to only sometimes work? What are the constraints on using it? It seems sometimes if a result set is generated, it becomes a null function, I assumed to prevent corrupting the resultset, but could it’s output not go out in another result set, such as the row count?
Share
So, if you have a statement something like the following, you’re saying that you get no ‘print’ result?
If you’re using SQL Query Analyzer, you’ll see that there are two tabs down at the bottom, one of which is ‘Messages’ and that’s where the ‘print’ statements will show up.
If you’re concerned about the timing of seeing the print statements, you may want to try using something like
raiserror ('My Print Statement', 10,1) with nowaitThis will give you the message immediately as the statement is reached, rather than buffering the output, as the Query Analyzer will do under most conditions.