触发器插入相同的数据就不行
ALTER TRIGGER [dbo].[triger_InsertDTC] ON [dbo].[NikeDTCDailyReport]
INSTEAD OF INSERT
AS
BEGIN
SET NOCOUNT ON;
DECLARE @code NVARCHAR(50) ,
@checkedCode NVARCHAR(50)
SELECT @code = ProductCode
FROM Inserted
SELECT @checkedCode = ProductCode
FROM dbo.NikeDTCDailyReport
WHERE ProductCode = @code
IF @checkedCode IS NULL
BEGIN
--PRINT 'null'
//入股为null 就插入在查询
INSERT INTO dbo.NikeDTCDailyReport
SELECT *
FROM Inserted WHERE Inserted.ProductCode=@code
END
ELSE
SELECT *
FROM Inserted WHERE Inserted.ProductCode=@code
END