sqldbgr is a command line utility that debugs stored procedures and triggers.
(UNIX) $SYBASE/$SYBASE_ASE/bin.
(Windows) %SYBASE%\%SYBASE_ASE%\bin, as sqldbgr.exe.
Attach sqldbgr to a task
Set, enable, and disable breakpoints
Step through a task one line at a time
Step into and out of procedures
Detach sqldbgr from stored procedures or triggers once the debugging is complete.
sqldbgr -U username -P password -S host:port
$SYBASE/$SYBASE_ASE/bin/sqldbgr -U sa -P -S MERCURY:16896
(sqldbg) stop in sp_who Breakpoint moved to line 20 (sqldbg) run sp_who (sp_who::20)if @@trancount = 0 (sqldbg) next (sp_who::22) set chained off (sqldbg) cont fid spid status loginame origname hostname blk_spid dbname cmd block_xloid 0 2 sleeping NULL NULL 0 master NETWORK HANDLER 0 0 3 sleeping NULL NULL 0 master NETWORK HANDLER 0 0 4 sleeping NULL NULL 0 master DEADLOCK TUNE 0 0 5 sleeping NULL NULL 0 master MIRROR HANDLER 0 0 6 sleeping NULL NULL 0 master ASTC HANDLER 0 0 7 sleeping NULL NULL 0 master ASTC HANDLER 0 0 8 sleeping NULL NULL 0 master CHECKPOINT SLEEP 0 0 9 sleeping NULL NULL 0 master HOUSEKEEPER 0 0 10 running sa sa 0 master SELECT 0 0 11 sleeping sa sa (sqldbg) show breakpoints 1 stop in sp_who (sqldbg)
$SYBASE/$SYBASE_OCS/bin/isql -U sa -P 1> select @@spid 2> go ------ 12 1> $SYBASE/$SYBASE_ASE/bin/sqldbgr -U sa -P -S MERCURY:16896
(sqldbg) attach 13 The spid is invalid (sqldbg) attach 12 (sqldbg) show breakpoints (sqldbg) stop in sp_who Breakpoint moved to line 20 (sqldbg) /* at this point run the sp_who procedure from spid 12 */ (sqldbg) where (sp_who::20::@loginname = <NULL>) (ADHOC::1::null) (sqldbg) next (sp_who::22) set chained off (sqldbg) next (sp_who::25)set transaction isolation level 1 (sqldbg) cont (sqldbg) /* at this point the sp_who result will show up in the isql screen */ (sqldbg) detach 12 (sqldbg)