I have procedure A,B,C. Procedure A calls B and C. Procedure B and C have loops and print statement in the loop (for me to understand whats happning). These procedure also have SEELCT (since its under testing phase all these selet and print) before loop.
But I have noticed that thouch the prints of B are not completly displayed it runs the Procedure C and displays SELECT result of C
And after some time it displayes remaining prints of B.
I am not able to understand this behaviour. As per my knowledge everything of B should get over and then only it should start with C.
Can anybody please explain me the reason of this behaviour
As has been suggested, you can use RAISERROR instead of PRINT statements. There's a catch, though. You have to use a "severity" of 10 or less (preferably just "0" so you know it's a PRINT substitution instead of a real error) and you have to use WITH NOWAIT. The reason for the "severity" of 10 or less is so that it doesn't actually raise an error.
Here's the simple syntax...
RAISERROR('Your message here.',0,1) WITH NOWAIT;
In the above, the "0" is the severity and the "1" is really just a marker (State) which can be assigned just about any number. Most people leave it at 1.
Now, before you go using it for a "instant" PRINT statement, please go look it up in "Books Online" so that you know of ALL the other wonderful things you can do with this remarkable statement especially when it comes to some of the "printf" options.
is pronounced ree-bar and is a Modenism for R
First step towards the paradigm shift of writing Set Based code: Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
If you think its expensive to hire a professional to do the job, wait until you hire an amateur. -- Red Adair
How to post code problemsHow to post performance problemsForum FAQs