sql server - Can I set defaults value for two columns in a table sql in one command? -



sql server - Can I set defaults value for two columns in a table sql in one command? -

can set default value 2 columns in table in sql

i tried below code

alter table tbl_labormoney add together constraint defaulzero default 0 "total paid amount","total balance amount"

but got error:

msg 173, level 15, state 1, line 1 definition column 'total balance amount' must include info type.

how ?

it possible define 2 constraints in single alter table, you'll need give sec constraint different name, , repeat constraint syntax, viz:

alter table tbl_labormoney add together constraint defaultzero default 0 "total paid amount", constraint defaultzero2 default 0 "total balance amount";

sqlfiddle here

sql-server

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -