debug too in SQL Analyzer

  • I enjoy using the debug tool lauched in SQL Analyzer. Most time it works quite well but sometimes, it just run to the end and ignors all breakpoints.

    The bad scenary sometimes occur on the different server, sometime on the same server but different times.

    Hope someone can tell me what is going on and how to make it work all the time.

     

    Thanks

    George

  • He George,

    Can U Tell Me How To Debug in SQL

     

    Regards,

    VG.

  • Open query analaser, connect to server, expand the db in the objects browswer, expand the sps, right click, debug. then you'll have to input the parameters of the proc, then it's just a plain basic debugger but it works great.

  • Sorry... no clue how to solve that problem. Can you give an exemple of the code that makes it fail?

  • Thank you for reply. The sample code is below. But I think the problem is not the code but the server/database status. The same piece of code run on a different server may just work fine.

    I use the stored procedure below to find all tables that contain a column. You can test run it without default parameters. In a debug session, if I set a breakpoint at the first print statement, and click GO (F5). The debug runs to the end, displays all result and return 0. Even I put breakpoints on every statement, it does the same. This is a trival sample, if the code is long and complicated, I really want the execution stop at where I want, that is main reason we use the debug tool.

    Here is the code

    =====

    CREATE PROCEDURE hlp_col_by_name 

    @tabStr varchar(32)='%',@colStr varchar(32)='user_name'

    AS

    print 'hlp_col_by_name @tabStr='+@tabStr+',@colStr='+@colStr

    if exists (select * from tempdb..sysobjects where name = '##col_resut' and xtype='U')drop table ##col_resut

    select @colStr='%'+@colStr+'%',@tabStr='%'+@tabStr+'%'

    select distinct o.name

    ,c.name [column], t.name type,c.length into ##col_resut

      from syscolumns c join systypes t on c.xtype=t.xtype   join sysobjects o on o.id=c.id

     where c.name like @colStr and o.name like @tabStr order by o.name

    select * from ##col_resut order by

    GO

  • Hard to say what's heppenning I'd have to be there cause I never saw that either.

  • Hi George,

    Thanks For UR Reply

    I will try and let u know if im having any probleme.

    Regards,

    VG

  • In this case, the debugging won't work as you explain it. The statements in the procedure are not being executed, only the CREATE PROCEDURE statement is being executed.

     

    --------------------
    Colt 45 - the original point and click interface

  • Can you expand on that theory??

  • Phill,

    Did you state that you have run the code under debug and no statements, except the create procedure, got run ?

    I see the other scenary.

    When I run the code in debug tool, all statements got executed and result displayed in the lower panel. But the breakpoints I have set did not work. I actually put breakpoints at every statement, but it just run to the end and return 0 (no error).  

    In a normal and correct case, I should be able to make the debug tool stop at each executable statement I put a breakpoint at.

    george

  • Make sure the remote server is not running under "Local system account"!

     


    * Noel

Viewing 11 posts - 1 through 10 (of 10 total)

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