title: Generating custom ID for my application
body: <p>I want to generate a custom ID for one of the feature in my application. Here is the procedure to do that:</p>
  
  <pre><code>CREATE PROCEDURE [dbo].[GetNextVendorInvoiceNo]
  AS
  BEGIN
  
      Declare @StartingVendorInvoiceNo    int = 0
  
      Select @StartingVendorInvoiceNo = MAX(StartingVendorInvoiceNo) + 1
          From SystemSettings WITH (TABLOCK)
  
      Update SystemSettings
              Set StartingVendorInvoiceNo = @StartingVendorInvoiceNo  
  
  
      Select @StartingVendorInvoiceNo 
  
  END
  </code></pre>
  
  <p>Would there be any issue if multiple users end up calling this procedure. Obviously I don't want multiple users to have the same ID. I am using TABLOCK but not sure if this is the right way or anything else too is required.</p>