SELECT * INTO #mytable FROM inserted WHERE 1=2 IF condition = 'A' INSERT INTO #mytable SELECT * FROM inserted ELSE INSERT INTO #mytable SELECT * FROM inserted WHERE abc = 'A'>I have trigger code as below. SQL Server complaint "There is already an object named "#mytable" in the database. But I already restart the server.
CREATE PROCE myTrigger ON mytable FOR INSERT >AS >BEGIN > IF condition = 'A' > SELECT * INTO #mytable FROM inserted > ELSE > SELECT * INTO #mytable FROM inserted WHERE abc = 'A' >END>