Unanswered: Conditional execution of DDL statements.
I have the following code being added in one of our batch execute sql.
if not exists (select * from syscolumns where name = 'EmpMinSal' and
id = (select id from sysobjects where name = 'EmployeeTb'
and uid = user_id()))
ALTER TABLE EmployeeTb
Add EmpMinSal numeric(11,2) default 5000
Ofcourse when the sql is executed for the first time on the database, it works fine. But every other time this sql is run, it doesnt seem to evaluate the if condition. It directly executes the alter table script. Is it that when there are DDL statements, no matter what, they get executed.
Adaptive Server Enterprise/12.5.2 -- This is the version that I am on.