|
| |||||||||
| Tags: boolean values, constraint, database, default |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| |||
| |||
| Default constraint in database
Hello sir, I am creating a table and need to specify a column as a TRUE or FALSE values but Unable to find any concept regrading this.I tried it from book also.I need to know in detailed about this.I am excited to implement it and need your help. Thanks.. |
|
#2
| ||||
| ||||
| Default constraint in database Default constraint : The default constraint is very useful constraint to insert the default value into the column but there is no any concept of Boolean values in the database.It is applied for the database parameter which is performed by DBMS itself. You can implement the Boolean values according to your way with the help of Default constraint. |
|
#3
| |||
| |||
| Specifying Default constraint in database Specifying Default constraint : You can specify the default constraint for table column after and before creation of the table.Add the Default option with column during creation and using alter command you can add it later. This is the syntax to implement the default constraint for a database : Code: CREATE TABLE Persons ( Id int NOT NULL, Name varchar(255) NOT NULL, City varchar(255), Sex DEFAULT 'M' ) |
|
#4
| ||||
| ||||
| DEFAULT Constraint on ALTER TABLE DEFAULT Constraint on ALTER TABLE: You can ALTER the table of database and implement the DEFAULT constraint.To do this you need to alter table first and then column with the combined statement.Use this statement to perform this task : Code: ALTER TABLE Persons ALTER COLUMN City SET DEFAULT 'Washington'; |
|
#5
| ||||
| ||||
| DROP a DEFAULT Constraint Dropping the DEFAULT Constraint : You can drop the default constraint after implementing.The column would be free from any restriction of constraint.Use following SQL statement to drop it : Code: ALTER TABLE Persons ALTER COLUMN City DROP DEFAULT |
![]() |
|
| Thread Tools | Search this Thread |
| |
Similar Threads for: "Default constraint in database" | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Task Start Date does not match constraint | ctslaton | Microsoft Project | 2 | 17-09-2011 05:57 AM |
| Vista - default printer doesn't stay as default | Freddie Kang | Vista Help | 8 | 19-04-2010 04:12 AM |
| Schema modification: relaxing constraint from single-valued to multi-valued. | Chuck Chopp | Active Directory | 1 | 20-01-2010 03:54 PM |
| convert filemaker pro database to access database | Albert Bricker | MS Office Support | 4 | 13-11-2009 12:32 AM |
| ADAM groupofnames constraint violation | jag9750 | Active Directory | 3 | 23-04-2009 02:38 AM |