How to auto generate UniqueIdentifier on insert query in Sql Server?
<p>I have a table AUDITS </p>

<pre><code>CREATE TABLE AUDITS
(
    Audit_ID uniqueidentifier not null,
    LocationID char(10) 
        FOREIGN KEY REFERENCES LOCATIONS (LocationID) not null,
    DateChangement date not null,
    NomColonneChangé varchar (20) not null,
    AncienneValeur  varchar (20)  not null,
    NouvelleValeur  varchar (20) not null,

    CONSTRAINT pk_AUDIT PRIMARY KEY (Audit_ID)
)
</code></pre>

<p>Now I have an update trigger that inserts into this table but I want the Audit_ID to be generated automatically by SQL Server. </p>

<p>I thought this way is right : </p>

<pre><code>if (......)
....
...
 INSERT INTO [MultiLocation].[dbo].[les_AUDITS]
       ([LocationID]
       ,[DateChangement]
       ,[NomColonneChangé]
       ,[AncienneValeur]
       ,[NouvelleValeur])
  VALUES
       (@LocationID ,
       @DateChangement ,
       @NomColonneChangée ,
       @AncienneValeur,
       @NouvelleValeur )
</code></pre>

<p>But it says it's impossible to insert a NULL value into <code>Audit_ID</code>.</p>

<p>How should I do it?</p>