title: max value in insert into
body: <p>I need to get the maximum number in a column because in a insert operation I have to insert max number in that column +1 for each insert, I did this:</p>
  
  <pre><code>insert into table1(id ,.., field,...)
  select newid(), ..., (SELECT CONVERT(VARCHAR(8), FORMAT((MAX(number)+1),'00000000'))
     FROM table1)
  </code></pre>
  
  <p>It works just for the first inserted row, than I get this number for other rows too!</p>