• There are two ways you could do this. The first is using the MERGE keyword. I have not used MERGE, though, because it hasn't yet been useful to me. So you would have to look it up in Books Online.

    The second solution would be an IF...ELSE statement. Something like:

    IF (SELECT BankID FROM EPSBankRef

    WHERE BankID = SUBSTRING('@Request.TransDesc~', 0, 25) ) IS NOT NULL

    BEGIN

    UPDATE EPSBankRef

    SET OrthoID = '@Request.inpHidden~'

    WHERE BankID = SUBSTRING('@Request.TransDesc~', 0, 25);

    END

    ELSE

    INSERT INTO EPSBankRef (BankID, OrthoID)

    VALUES (BankID, OrthoID);

    GO

    You could also use a SELECT in place of the VALUES if you're pulling the data from another table. And obviously you need to fix the column list for both sides of the INSERT to reflect the true columns you're inserting into.

    Hope that helps.

    Brandie Tarvin, MCITP Database AdministratorLiveJournal Blog: http://brandietarvin.livejournal.com/[/url]On LinkedIn!, Google+, and Twitter.Freelance Writer: ShadowrunLatchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle.