我想在表中插入數(shù)據(jù),但是只插入數(shù)據(jù)庫中不存在的數(shù)據(jù)!這是我的代碼:ALTER PROCEDURE [dbo].[EmailsRecebidosInsert] (@_DE nvarchar(50), @_ASSUNTO nvarchar(50), @_DATA nvarchar(30) )ASBEGIN INSERT INTO EmailsRecebidos (De, Assunto, Data) VALUES (@_DE, @_ASSUNTO, @_DATA) WHERE NOT EXISTS ( SELECT * FROM EmailsRecebidos WHERE De = @_DE AND Assunto = @_ASSUNTO AND Data = @_DATA);END錯誤是:消息156,級別15,狀態(tài)1,過程EmailsRecebidosInsert,第11行關(guān)鍵字“ WHERE”附近的語法錯誤。
SQL Server插入(如果不存在)
慕的地8271018
2019-10-16 14:39:27