📜  如果不存在插入 sql 代码示例

📅  最后修改于: 2022-03-11 15:05:26.857000             🧑  作者: Mango

代码示例1
IF NOT EXISTS (SELECT * FROM EmailsRecebidos 
                   WHERE De = @_DE
                   AND Assunto = @_ASSUNTO
                   AND Data = @_DATA)
   BEGIN
       INSERT INTO EmailsRecebidos (De, Assunto, Data)
       VALUES (@_DE, @_ASSUNTO, @_DATA)
   END