Advertise with us

Setting default value and displaying in checkboxes

Hi Everyone!

Okay so this is a bit of a double question problem, but they are both related. The first question is how would I set a default value for my column as I want it to be

true/1 (it's a bit column in case you hadn't guessed) and the second issue is that I have a row of checkboxes and I want these to be ticked when I have the value set

as true, my current command is:

cmd.CommandText = "ALTER TABLE tbl_ecom_cat_feature ADD display_on_search BIT";

Thanks in advance!
Last updated:5/4/2013 9:04:16 AM

1 Answers

AVADHESH PATEL
AVADHESH PATEL

Hi Ashish!


For Get Default Value Use : SELECT * FROM INFORMATION_SCHEMA.COLUMNS Where ...

For Set Default Value Use : ALTER TABLE {TABLENAME} ADD {COLUMNNAME} {TYPE} {NULL|NOT NULL} CONSTRAINT {CONSTRAINT_NAME} DEFAULT {DEFAULT_VALUE}

Answer