Skip to content
Advertisement

alter column table and make default value to empty string

good day.. just want to ask, is it possible to alter a column table and make the default value to empty string..

i tried using this query,

    Alter Table Employee Alter Column sJobTitle Varchar(200) DEFAULT '' 

Unfortunately, it doesn’t work..

Please let me know, if ‘m doing it correct..

Thanks,

Link

Advertisement

Answer

You need to add a contraint. Referring to http://blog.sqlauthority.com/2008/05/31/sql-server-create-default-constraint-over-table-column/

ALTER TABLE Employee 
        ADD CONSTRAINT DF_Employee _JobTitle
        DEFAULT '' FOR sJobTitle 
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement