title: I want to generate random date in SQL Server
body: <p>Can anyone please tell me I want to generate 100 random dates for my table:</p>
  
  <pre><code>create table dates (dt date)
  </code></pre>
  
  <p>This code is ok I want to put below code in loop so that it will generate 100 random dates</p>
  
  <pre><code>SELECT
      DATEADD(second, (rand() * 60 + 1), 
      DATEADD(minute, (rand() * 60 + 1),
      DATEADD(day, (rand() * 365 + 1), 
      DATEADD(year, -1, getdate())
  </code></pre>
  
  <p>or any other simple code to <code>generate random</code> date give me if you can.</p>
  
  <p>Thanks</p>
  
  <p>praviin </p>