title: SQL Server Exception Message Format
body: <p>On this page <a href="https://technet.microsoft.com/en-us/library/cc645611(v=sql.105).aspx" rel="nofollow">Sql Server Errors 1-999</a> there is a list of SQL Server errors and the associated message text. </p>
  
  <p>For example:</p>
  
  <blockquote>
    <p>Err 2627: Violation of %ls constraint '%.*ls'. Cannot insert duplicate
    key in object '%.*ls'.</p>
  </blockquote>
  
  <p>An example of this exception is:</p>
  
  <blockquote>
    <p>Violation of UNIQUE KEY constraint
    'AK_AdvanceShipmentNotices_CustomerId_PurchaseOrderNumber'. Cannot
    insert duplicate key in object 'dbo.AdvanceShipmentNotices'. The
    duplicate key value is (4, 1000).</p>
  </blockquote>
  
  <p>The example error text contains placeholders: %ls and %.*ls. Looking through the rest of the error examples, there are a number of other placeholders, e.g. %d, %s, %S_DATE, %hs, %S_TS, %x, and so on.</p>
  
  <p><strong>QUESTION</strong>: are these placeholders defined anywhere, or do I simply need to work out for myself what they all mean?</p>
  
  <p>Other example errors:</p>
  
  <ul>
  <li><p>Err  21: Warning: Fatal error %d occurred at %S_DATE. Note the error and time, and contact your system administrator. </p></li>
  <li><p>Err 103: The %S_MSG    that starts with '%.*ls' is too long. Maximum length is %d.</p></li>
  <li><p>Err 262: %ls permission denied in database '%.*ls'.</p></li>
  <li><p>Err 407: Internal error. The string routine in file %hs, line %d failed    with HRESULT 0x%x.</p></li>
  <li><p>Err 408: A constant expression was encountered in the ORDER BY list, position %i.</p></li>
  <li><p>Err 479: Invalid ROWS value or REPEATABLE seed "%I64d" in the TABLESAMPLE clause for table "%.*ls". The value or seed must be greater than 0.</p></li>
  <li><p>Err 532: The timestamp (changed to %S_TS) shows that the row has been updated by another user.</p></li>
  <li><p>Err 552: CryptoAPI function '%ls' failed. Error 0x%x: %ls</p></li>
  <li><p>Err 2627: Violation of %ls constraint '%.*ls'. Cannot insert duplicate key in object '%.*ls'.</p></li>
  </ul>