title: Generating auto increment unique ID which contain today date, month, year and some number in SQL Server
body: <p>I want to create a auto generate unique Id which contains today's date, month, year and some number.</p>
  
  <p>Ex. in year 2016-only 16 will be used, for the month of January 01 will be used, and for today's day 26 would be used, and the slno is starts 0001 to 9999</p>
  
  <p>So my id should be like <code>1601250001</code>.</p>
  
  <p>The date changes everyday.</p>
  
  <p>I have tried but not working please rectify my code</p>
  
  <pre><code>Create procedure InsertRegistration
  (
      @name nvarchar(50),
      @Address nvarchar(100)
  )
  as
  begin
      DECLARE @BdID VARCHAR(25)
  
      SET @BdID = (SELECT convert(varchar, getdate(), 112))+
                   CAST(((SELECT COUNT(*) 
                       FROM BasicInformation  
                   WHERE @BdID like (SELECT convert(varchar, getdate(),112))+'%') 
                         +1 ) AS VARCHAR(5))
  
       Insert into BasicInformation(BdID, name, address) 
       values (@BdID, @name, @address)
  end
  </code></pre>
  
  <p>It's working but the increment is not happening for each registration. I am a beginner. Please help me</p>