debug a stored procedure

  • Is it possible to debug a stored procedure using Management Studio??

    Thanaks

  • The only way i see is, script it to create or alter and then debug. 😉

  • I assume you want to be able to step through the code?

    http://blogs.msdn.com/b/billramo/archive/2009/04/11/transact-sql-debugger-for-sql-server-2008-part-1.aspx

  • CELKO (9/29/2011)


    No. we usually insert a PRINT statement in the right place. Since procedures in T-SQL should not be over 50 lines and mostly pure SQL code, why would this be a problem? Are you trying to write a payroll in T-SQL?

    Being a 2K8 forum, I'd have assumed the definitive answer to be "Yes".

    The functionality is not undocumented or obscure.

    Using PRINT to monitor execution and debug was more than necessary prior to 2008.

    Regarding 50 lines max per proc - I'd love to live in a world where this was true - where procs were well re-factored and design followed intelligent patterns.

    However, reality puts us in a place where we have to deal with poorly formed code and where business simply doesn't allow us the time to polish the mess our predecessors left behind. "If it ain't broke, don't fix it" seems to be the modus operandi.

    PS.

    Is there a valid reason not to use debug?

  • we can use debugger on sql 2008 onwords, but there are some configuration to be made for this

    follow this link to get the idea how to use it.

    http://blogs.msdn.com/b/billramo/archive/2009/04/11/transact-sql-debugger-for-sql-server-2008-part-1.aspx

    it is suggested not to use debugger on production environment as it's put lock on the objects associated with, which will be a deadly thing to do.

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply