Debug output in stored procedures
I’m a little miffed that you can only debug stored procedures in VS2005 pro and not in VS2005 standard. The frustrating thing is that you can view, edit and trace in VS2005 standard and the menu item for break points is there but it’s greyed out. Pah I say.
This little problem led me to rediscover how to do debug output in T-SQL. The command you need is called print():
-
print('RelationshipID: ' + convert(varchar, @RelationshipID))
The only tricky thing is that everything has to be a text type before it can be concatenated so you’ll need to use the cast or convert methods to use other data types. It really doesn’t like concatenating nulls either. I found that my print statement just didn’t work if my variable happened to be a null. They need to be converted to a text type first.
