Add A Constraint To An Existing Table

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Yogesh Sharma
    New Member
    • Mar 2008
    • 40

    Add A Constraint To An Existing Table

    create table student(roll int,name varchar(10))
    insert into student values(1,'YOGES H')

    ALTER TABLE student ADD CONSTRAINT cont_name
    NOT NULL(name)
    Incorrect syntax near the keyword 'NOT'.

    I m not getting how to add constraint.
  • ck9663
    Recognized Expert Specialist
    • Jun 2007
    • 2878

    #2
    I think this you're going to define this as CHECK CONSTRAINT. Here's the full ALTER TABLE syntax.

    -- CK

    Comment

    Working...