Is there a way to step through SQL code in debugging mode?

327 Views Asked by At

I am not a SQL developer, but I have a bit of SQL that is longer and more complex than my usual query/update. It is not a stored proc (policy thing).

(The code reads some state into variables, selects some data into temp tables, and performs some updates and deletes. There are a few loops to perform the deletes in small batches, as not to fill the transaction log.)

If I were writing code in Java I could create some test data and step through the method to watch the data being manipulated. Are there any tools that DB developers use to debug their code in a similar fashion?

1

There are 1 best solutions below

0
markp-fuso On

You haven't provided any details on how your SQL is being processed, eg:

  • is your application submitting SQL batches to ASE? perhaps as a looping construct submitting prepared statements? [if so, you'll likely have a better chance of finding a debugger for your application; otherwise, add some print/select statements, perhaps based on a debug variable being set]

  • is your application submitting a (large) SQL batch to ASE? [if so, you may be able to use ASE's sqldbgr utility to step through your SQL code; you can find more details about ASE's sqldbgr in the ASE Utility Guide]