Results 1 to 2 of 2
  1. #1
    Join Date
    May 2003
    Location
    Barcelona
    Posts
    22

    Unanswered: To define data types with Check Constraints

    I’ m trying to define specific data types with Check Constraints. I want to define a column so that only be able to enter a code consisting in eight numbers and one letter in capital, for instance: ‘25814712X’. I’ ve obtained successfully result except the letter that accept small letters, and I only want to accept capitals (‘Ρ’ character included). The syntax is as follows:

    ALTER TABLE Users
    ADD CONSTRAINT CK_code
    CHECK (User_code LIKE '[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][A-Z]')


    How can I write it so that only be able to accept letters in capitals? (‘Ρ’ character included)

    How can I write a Check Constraint that only allows a characters set which contains the character ‘@’ between that, and finishes with ‘.com’, ‘.net’, ‘.uk’, ‘.fr’, ‘.org’, etc,..? I want user only be able to write the correct e-mail format.


    Thanks,
    Cesar

  2. #2
    Join Date
    May 2003
    Location
    Barcelona
    Posts
    22

    Thumbs down NOBODY KNOWS,..! seems incredible

    Is one of the first steps in a data base design, TO DEFINE THE CHECK CONSTRAINTS that guarantee the structure of some fields !! Like e-mail, password, zip_code, URL, etc,..

Posting Permissions

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