I’m trying to create a trigger on a table. My requirement is to create trigger only when the table exists.
e.g.
if(table exists)
begin
create trigger on the table
end
After googling, I found that create trigger should be first command in the batch.
That means I can not use the if or any other thing in the current batch.
Please, help me out!
You can use
You will need to escape any single quotes in the trigger body by doubling them up.