开发者

Debugging a SQL Query

开发者 https://www.devze.com 2023-01-08 04:51 出处:网络
Does SQL Server 2008 have a built in debugger? I\'ve got a stored procedure that returns an error if it is fed a string of alphabetic chara开发者_StackOverflow社区cters (as opposed to numeric) and I\'

Does SQL Server 2008 have a built in debugger? I've got a stored procedure that returns an error if it is fed a string of alphabetic chara开发者_StackOverflow社区cters (as opposed to numeric) and I'd like to be able to determine what line it gets to before returning an error.


Yes, you can debug SQL stored procedures, functions, triggers, etc.

http://www.mssqltips.com/tip.asp?tip=1695


SQL Server Management Studio can debug stored procedures in SQL Server 2008. Open your stored procedure, and instead of hitting the "execute" button (the red exclamation mark) hit the "debug" button (the green "play" arrow).

http://www.mssqltips.com/tip.asp?tip=1695


I would add PRINT 'Checkpoint A passed' type statements at various points to see how far it gets.. the output would appear on the Messages tab. It's a lame way of debugging, but it works.

insert into blah blah blah

print 'Passed the insert'

select blah

print 'Passed the select'


You can try the Transact SQL Debugger I've never used it but remember reading about it somewhere.

0

精彩评论

暂无评论...
验证码 换一张
取 消