title: Is there a way to store the value of DBCC CheckIdent into a variable?
body: <p>I'm trying to do something like this:</p>
  
  <pre><code>declare @myCurrentSeedValue int;
  select @myCurrentSeedValue = DBCC CheckIdent('MyTable', NORESEED);
  </code></pre>
  
  <p>That obviously is incorrect syntax.  Does anyone have any suggestions of how I can accomplish this?</p>
  
  <p>I know that I can do something like this:</p>
  
  <pre><code>select @myCurrentSeedValue = IDENT_SEED('MyTable');
  </code></pre>
  
  <p>But the problem with that is that per MSDN on the IDENT_SEED function: </p>
  
  <blockquote>
    <p>Changing the current value of an identity column by using DBCC CHECKIDENT does not change the value returned by this function.</p>
  </blockquote>
  
  <p>This can be problematic because we have other stored procedures that will call the DBCC CHECKIDENT and reseed the identity column, so I actually need the current seed not the original.</p>