You can use merge statement as below

MERGE editor_Questions AS Target
    USING (
    SELECT  ParamValues.x1.value('categoryID[1]', 'int') AS categoryID,
            ParamValues.x1.value('question[1]', 'nvarchar(1000)') AS question,
            ParamValues.x1.value('sortID[1]', 'int') AS sortID,
            GETDATE() AS [Date],
            ParamValues.x1.value('modBy[1]', 'varchar(50)') AS ModBy
    FROM    @xml.nodes('/ranks/item') AS ParamValues(x1)

    ) AS SOURCE
    ON Target.categoryID =SOURCE.categoryID
    WHEN MATCHED THEN 
    UPDATE SET Target.question = Source.question,
            Target.sortID = Source.sortID,
            Target.modDate=Source.[Date],
            Target.ModBy = Source.ModBy
    WHEN NOT MATCHED  THEN
    INSERT 
        (
            categoryID,
            question,
            sortID,
            modDate,
            modBy       
        )
    VALUES  (categoryID,question,sortID,[Date],ModBy);


SQL Server: update table from xml string
If I were to write a web application using openpgp.js (http://openpgpjs.org/) for creating PGP encrypted/signed messages and if I stored the user's private key in localStorage, would this be vulnerable to the same complaints about JavaScript cryptography on Matasano's webpage (http://www.matasano.com/articles/javascript-cryptography/)?

As far as I can tell, the main points outline by Matasano are:


"Secure delivery of Javascript to browsers is a chicken-egg problem." (This could be fixed by using HTTPS)
JavaScript isn't well suited to cryptography
Browsers are too complex for cryptography since they have the potential to contain multiple attack vectors.


If localStorage isn't the best place to store something sensitive like a private key, what would be a better place?
