Is it possible to set a column's default value for an existing table?
I'm trying the following way, but the column always gets null instead of the default value that was entered.
IF NOT EXISTS (SELECT * FROM SYSCOLUMNS C INNER JOIN SYSOBJECTS T ON C.id = T.id WHERE C.name = ('IsPreparacao') AND T.name = 'Cadastro')
BEGIN
ALTER TABLE Cadastro
ADD IsPreparacao bit default 0
END
I have already searched the net and found nothing to help me as my problem, can anyone help me with this question?
Thank you very much for being able to help me.