Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Stored Procedure Debugging - HOW!

Author  Topic 

eglons
Starting Member

15 Posts

Posted - 2007-03-03 : 13:14:29
I've got a stored procedure which does a database search for me. It is working fine, but for some reason it isn't finding what I expect. I think the problem is that the vairables are not being passed as I expect but I cannot work out how to see the intermediate SQL in the stored proc... in oracle there used to be some sort of set feedback on option which meant that all SQL which was being run was shown... is there some way of doing this in SQL Server 2005?

Thanks

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-03-03 : 13:42:41
run sql profiler and see what statements are being executed

Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

eglons
Starting Member

15 Posts

Posted - 2007-03-03 : 13:55:58
Sorry.... I'm using Studio Express 2005 and can't find a SQL Profiler?

I've tried to do the following within a stored procedure which I then execute and get nothing back, no error nothing:

SELECT @SearchSQL =
'SELECT blah blah.... etc'

print @SearchSQL;

Doing the same in a query window works fine... ?
Go to Top of Page

eglons
Starting Member

15 Posts

Posted - 2007-03-03 : 15:19:58
I've now sorted this out... although to be honest I cannot work out what changed... the print statement now works and I can see the SQL statements I was after.
Go to Top of Page

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2007-03-03 : 15:32:46
probably some null values being concatenated with...

--------------------
keeping it simple...
Go to Top of Page
   

- Advertisement -