Use SQL statements to create and delete constraints.
Use an SQL statement to create or delete a Primary Key constraint of the constraint type (Primary Key constraint) --: The Primary Key column data must be unique and cannot be blank. Unique constraint (Unique constraint) --: This column must be Unique and can be null, but only one null value can appear. Check constraint: the restriction on the value range and format of a column, for example, the restriction on age and email address (@ is required. Default constraint: the Default value of a column. If there is a large number of duplicates in the database, it can be set as the Default value. Foreign Key constraint (Foreign Key constraint) --: used to establish a relationship between two tables. You must specify the column that references the primary table. **************************************** * ***************************** Add constraints: alter table tablename add constraint pk_colname primary key (colname) primary constraint alter table tablename add constraint uq_colname unique (colname) unique constraint alter table tablename add constraint df_colname default ('address unknown ') for colname default constraint alter table tablename add constraint ck_colname check (colname between 12 and 15) check constraint alter table tabl Ename add constraint fk_colname foreign key (colname) references tablename (colname) External creation constraint Delete constraint: alter table tablename drop constraint name create login account/database user create Login Account: exec sp_grantlogin 'windows domain name/domain account' to create a database user: exec sp_grantdbaccess' login account', 'database user' to authorize the database: grant permission [on table name] to database user the preceding statements can be used to operate Enterprise Manager/security/login/New Login directly in Enterprise Manager and enter the name and password to select database access, in the "database role allow" db_owner, the default constraint is also checked so that the user can define a value. Whenever the user does not enter a value in a column, the defined value is provided to this column. If you do not have specific requirements for this column, you can use the default constraint to enter the default value for this column.