title: Generate a primary key on index view using T SQL
body: <p>I try to create an index view, and unique clustered index on the view. My problem is that how to generate a primary key within a select clause. E.g.</p>
  
  <pre><code>Create view ssrs.vMyView
  with schemabinding
  as
    select firstname, lastname, other columns  --example columns
    from mytable
  </code></pre>
  
  <p>how to generate a primary key for each row on the fly?</p>
  
  <p><strong>Update</strong></p>
  
  <p>The problem is that it does NOT have unique columns or combination of columns, so I need to generate a unique id on the fly. <strong>Firstname and lastname are just example.</strong> There are primary key for the base table.</p>
  
  <p>Thanks in advance!</p>