Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: Altering table.

  1. #1
    Regular Coder saeed's Avatar
    Join Date
    Oct 2002
    Location
    West Yorkshire
    Posts
    343
    Thanks
    32
    Thanked 0 Times in 0 Posts

    Altering table.

    i want to alter a table by adding a not null constraint in one the attribute.

    table name = customer

    custid varchar2(10) ~Primary Key~
    custname varchar2(15)
    custsname varchar2(15)
    custadd varchar2(40)

    the table is already created but "custname" should not be left blank.
    I want to know how can i alter table and add not null constraint in custname attribute.

    Thanks.

    Saeed.

  • #2
    Senior Coder
    Join Date
    Sep 2005
    Posts
    1,791
    Thanks
    5
    Thanked 36 Times in 35 Posts
    ALTER TABLE customer ALTER COLUMN custname SET NOT NULL

    But this will depend on what database you're using...and if there are any null entries at the moment, it won't work


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •