Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • SQL CHECK Constraint

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 204
    Comment on it

    It limits the value range which is mentioned in column.

    Example of check constraint

    CREATE TABLE Persons
    (
    PId int NOT NULL,
    LastName varchar(255) NOT NULL,
    FirstName varchar(255),
    Address varchar(255),
    City varchar(255),
    CONSTRAINT chkPerson CHECK (PId>0 AND City='dehradun')
    )
    

    SQL CHECK Constraint on ALTER TABLE

    ALTER TABLE Emp
    ADD CHECK (PId>0)
    

    To DROP a CHECK Constraint

    ALTER TABLE Emp DROP CHECK chk_Person

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: