title: How are unique IDs / sequence numbers generated in SAP B1?
body: <p>I'm wondering if anyone knows how SAP B1 (SAP Business One) generates the unique primary keys it uses in various tables. Examples of what I am talking about would include <strong>OCRD.DocEntry</strong> and <strong>OCPR.CntctCode</strong>. These integer columns that get &quot;automatically&quot; incremented.</p>
  <p>Typical approaches for doing this include identity columns (e.g., SQL Server), sequences (e.g., Oracle), or manual sequence tables holding a Nextval which is programmatically incremented. As best I can tell, B1 is not using any of these techniques for these columns. So how is it handling them?</p>
  <p>The particular instance I'm looking at is using an SQL Server database.</p>
  <p>Yes, I'm well aware of the fact that there is no &quot;need&quot; for me to know know about the inner workings, shouldn't be mucking around in the DB, etc. It's just bothering me that I don't know how they are doing it! If anyone can explain, I'd be grateful.</p>