title: Debug function in SQL Server 2008 that is invoked by triggers?
body: <p>I have a situation where a (user-defined) function that is invoked by (legacy) triggers apparently calculates and enters a wrong value into a table. The problem surfaces e.g. when one <code>UPDATE</code>s the value, which then immediately reverts to another/wrong value, apparently because the function kicks in with a wrong calculation.</p>
  
  <p>I am not yet familiar with the SQL Server's debugger. Can I e.g. set a breakpoint it the function such that execution will stop in the SF after launching the offending <code>UPDATE</code> and I can then inspect values and single-step. Is this possible and is there perhaps a good tutorial on this kind of scenario?</p>
  
  <p>So far, I have tried this:</p>
  
  <ol>
  <li>opened SF with "Modify"; set breakpoint in line with 'SELECT'</li>
  <li>opened "New Query"; executed <code>UPDATE</code></li>
  </ol>
  
  <p>This did not work insofar as the reversion did not occur (<code>UPDATE</code> worked as if there were not triggers and SF was not invoked). Perhaps it is because the SF and query belong to different sessions or because I lack sufficient privileges. How can I make progress from this (or a better) starting point?</p>