Thursday, July 18, 2019

Wednesday, July 17, 2019

Strategy for Debugging Stored Procs When you have very few Permissions

Preconditions:


Insufficient Privileges such that...

  1. Can't run debugger on stored procs in DB
  2. Can't create new stored procs in DB
  3. Can't modify stored procs in DB
  4. Can't delete stored procs in DB
You CAN:

Execute scripts and Modify Rows


Strategy:
  1. Copy entire Stored Proc
  2. Paste it into a new query window
  3. Change the proc's parameters to Variables (DECLARE @FOO AS VARCHAR(25) = 'Bar';)
  4. Remove all stored proc syntax from top and bottom of script
  5. Get it to run in SSMS Query Window
  6. Add Debugging code in the best form fitting the current circumstances
  7. If so desired, copy SQL into C# code and ADO.Net it from there (or whatever)

Just think outside the box.


C# Sucks!

JK!! Seriously, though, somewhere around C#-3 we should have inculcated ourselves with the question: "Does 'CAN' == 'SHOULD...