Published on

IF statements in custom stored procedures

Authors
  • avatar
    Name
    Mike Barram
    Twitter

You may want your custom stored procedures to contain conditional statements such as IF. These can cause problems when NetTiers inspects the procedure to determine its outputs – it may normally return a table but an IF statement traps for an exception and conditionally returns before the select statement. You can force NetTiers to follow one route through the code e.g. the statement below will never return for NetTiers

IF user_name() <> 'NetTiersUserAccount' AND ThingToTest = ValueThatMakesItReturn RETURN

Just make sure that the user account in the connection string used by NetTiers is not used by anything other than NetTiers i.e. not in you web.config