Hello all.
Im having an issue with a task. I want to write values into a temp table from an if and else condition.
However in to into #temptable clause of the else it is saying that the table already exist...but it kinda doesnt exist since either the if or else will run.
Here is the code. basically i want to enter in file2 where the date is more that @mdate_s or when it is less.
Thank u
Im having an issue with a task. I want to write values into a temp table from an if and else condition.
However in to into #temptable clause of the else it is saying that the table already exist...but it kinda doesnt exist since either the if or else will run.
Here is the code. basically i want to enter in file2 where the date is more that @mdate_s or when it is less.
Thank u
IF @mdate_s < (SELECT MAX(date) from dbo.activity where id=@id) BEGIN SELECT activity.*, members.*, INTO rep.#mFile2 FROM dbo.activity INNER JOIN dbo.members ON activity.id=members.id WHERE members.id=@id AND trans='P' AND code='MEO' END ELSE BEGIN SELECT activity.*, members.*, INTO rep.#mFile2 FROM dbo.activity INNER JOIN dbo.members ON activity.id=members.id WHERE members.id=@id AND trans='P' AND code='MEO' END