November 1, 2005 at 5:04 am
Hi Everyone
I have a beefy stored procudure which takes in 6 parameters and then does a bit of logic on the where clause. However, there is a problem with the results that are returned.
Is there anyway I can see the final SQL code that is generated from this logic, so I can see what is going wrong.
Cheers
pie
November 1, 2005 at 5:14 am
Why don't you just PRINT it?
November 1, 2005 at 5:30 am
that sounds cool, but how do I go about doing that?
November 1, 2005 at 6:06 am
Another trick that I use is to create a table to house SQL statements VARCHAR(8000). I string my SQL statement together and then write it to the table. I ONLY do this troubleshooting. This can be enabled/disabled with a flag parameter to perform this type of troubleshooting IF @WriteSQL = True BEGIN....
This has helped debug several different issues. Please note that it will take experimentation to get the statement to work (if there are ' )....
I use this approach so I can troubleshoot "off-line" and for monitoring purposes...
Good Hunting!
AJ Ahrens
webmaster@kritter.net
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply