UPDATE INTO rather than INSERT INTO based on a non-primary key column
<p>Now I know there is no such command as <code>UPDATE INTO</code>, however is it possible to do something similar rather than an <code>INSERT INTO</code> based on a non-primary key column?</p>

<p>For example, I want to check if a record with today's date already exists for a given person. If the value already exists, then update the record with the new figures, and if it doesn't exist (say the script is ran tomorrow) then insert it into the table.</p>

<p>Here is the code I'm working with;</p>

<pre><code>if OBJECT_ID('dbo.Temp') IS NULL 
    create table [dbo].[Temp] (
        UserID int,
        FullName varchar(300),
        DocsInBatch int,
        NumReviewed int,
        Outstanding int,
        Relevant int,
        HighlyRelevant int,
        Irrelevant int,
        OutOfScope int,
        Question int,
        TechnicalQuestion int,
        LastUpdate date

        PRIMARY KEY (UserID)
    )
insert INTO [dbo].[Temp]
SELECT a.UserID,
        a.FullName, 
        a.DocsInBatch, 
        a.NumReviewed, 
        (a.DocsInBatch - a.NumReviewed) AS "Outstanding",
        a.Relevant,
        a.[Highly Relevant],
        a.[Irrelevant],
        a.[Out-Of-Scope],
        a.[Question],
        a.[Technical Question],
        GetDate()
        FROM
    (
            SELECT au.UserID as [UserID],
                    au.FullName, 
                    count(1) AS "DocsInBatch", 
                    count([Document1LR_Relevancy].[CoArtID]) AS "NumReviewed",
                    sum(case when [Document1LR_Relevancy].[1LR_Relevancy] = 'Relevant' then 1 else 0 end) as 'Relevant',
                    sum(case when [Document1LR_Relevancy].[1LR_Relevancy] = 'Highly Relevant' then 1 else 0 end) as 'Highly Relevant',
                    sum(case when [Document1LR_Relevancy].[1LR_Relevancy] = 'Irrelevant' then 1 else 0 end) as 'Irrelevant',
                    sum(case when [Document1LR_Relevancy].[1LR_Relevancy] = 'Out-Of-Scope' then 1 else 0 end) as 'Out-Of-Scope',
                    sum(case when [Document1LR_Relevancy].[1LR_Relevancy] = 'Question' then 1 else 0 end) as 'Question',
                    sum(case when [Document1LR_Relevancy].[1LR_Relevancy] = 'Technical Question' then 1 else 0 end) as 'Technical Question'
                from [EDDS1024194].[EDDSDBO].[Document] doc
            LEFT JOIN (
                        SELECT XXX.ArtifactID, co.Name AS [1LR_Relevancy], Co.ArtifactID [CoArtID]
                        FROM [EDDSDBO].[Document] AS XXX WITH (NOLOCK)
                            INNER JOIN [EDDSDBO].[ZCodeArtifact_1001288] AS ca WITH (NOLOCK)
                                ON XXX.[ArtifactID] = ca.[AssociatedArtifactID]
                            INNER JOIN [EDDSDBO].[Code] AS co WITH (NOLOCK)
                                ON ca.[CodeArtifactID] = co.[ArtifactID]
                        ) AS [Document1LR_Relevancy]
                ON doc.[ArtifactID] = [Document1LR_Relevancy].[ArtifactID]
            INNER JOIN [EDDS1024194].[EDDSDBO].[DocumentBatch] db on
                db.DocumentArtifactID = doc.ArtifactID
            INNER JOIN [EDDS1024194].[EDDSDBO].[Batch] bat on
                bat.ArtifactID = db.BatchArtifactID
            INNER JOIN [EDDS1024194].[EDDSDBO].[AuditUser] au on
                au.UserID = bat.AssignedTo
            GROUP BY au.FullName, au.UserID

)a
ORDER BY a.FullName
</code></pre>

<p>This code works. It inserts new records into the table every time it is run, however I am unsure how to do the aforementioned. </p>