I just published a new article. This month, I will show you a little trick that you might not need very often but which will be invaluable the day you will need it.
If you are like me, you are using a lot of stored procedures from Microsoft SQL Server from within your applications. Sometimes, some of these stored procedures are not working as expected. Even if it is easier than before, debugging them might still be a pain for you if you don’t have all the permissions required.
The trick I will show you here is to add Print statements in your SQL stored procedures (which I hope is not new to you) and to retrieve these Print statements from your .Net applications.
When your stored procedure has a complex path (multiple If statement for example), it might be difficult to follow.
You can read this article from http://emoreau.com/Entries/Articles/2011/10/Retrieving-SQL-Print-statement-from-a-Net-Application.aspx