On 22 Feb., 03:48, blackbird <adam.c.k... (AT) gmail (DOT) com> wrote:
Quote:
Hopefully a simple one, but I can't find anything obvious in the docs.
I want to add a column to my database only if it doesn't exist, as my
versioning scheme has gone a bit awry.
Can I put the statement in some sort of SQL try-catch, or is there an
easy way to check before adding?
Thanks |
if not exists ( select 1
from sys.syscolumns
where creator = '__OWNER__'
and tname = '__TABLE__'
and cname = '__FIELD__'
) then
end if;
HTH