storing a Default Value in a Table
How to store a
Default Value in a table using sqlserver?
Suppose
there are 3 columns name, location and gender in a table called ‘default_tbl’.
I
am going to insert record in a default_tbl.
In
above output you can see I given only name and location values. I don’t want to
make a gender column as null. if the user forgets to give the value of gender, by default you have to store
the value as MALE.
You
have to set the default value of gender column. Open your Design Table, Select
the gender column. In Properties Enter ’ Male‘ under Default Value.
See
the below image how to set the default value:
Now I am
going to insert records without giving a gender values. You can observer the
output result in below image:
