title: how to add 1 to a value each time a new item is inserted SQL
body: <p>well I am stuck with a simple but very irritating problem.</p>
  
  <p>I am creating a program that will save documents to <em>SharePoint</em>, when I click it will save the documents:</p>
  
  <pre><code>name,
  date,
  username,
  location 
  version
  </code></pre>
  
  <p>to SQL. Now here is my problem. Each new documents version needs to increment/add by 1.
  So lets say we have version - 1 it must be version -2 when clicked 
  and I can't use auto-increment because there might be different docs 
  with different names and the version needs to be added according to the correct doc name.</p>
  
  <p>Now be-warned I am tired as hell and my SQL proc is not pretty:</p>
  
  <pre><code> @username varchar(100),
   @Type varchar(100),
   @Name varchar(100),
   @Version int,
   @Location varchar(100)
   AS
   SET @VERSION = 1
   INSERT INTO TABLE (Username,[Date],[Type],Name,[Version],Location)
   VALUES('Wolf',GetDate(),'pdf','doc',@version ,@Location)
   SELECT max([Version]) FROM table
  </code></pre>
  
  <p>this is roughly what it will look like now I just need to be able to add 1 to the version each time a new doc is inserted with the name lets say for argument sake its a Manual.</p>
  
  <p>aah to the oaks editing this please note i have not slept in 48 hours i am tired and spelling is the least of my worries</p>