Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2003
    Location
    Netherlands
    Posts
    98

    Unanswered: Creating check constraint

    Before adding a record this must check that in the column machine_id not twice the same machines are listed
    Can someone help me?

    Thanx and cheerz Wim

  2. #2
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Sure....

    Code:
    USE Northwind
    GO
    
    CREATE TABLE myTable99(Machine_Id int UNIQUE)
    GO
    
    INSERT INTO myTable99(Machine_ID)
    SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3
    GO
    
    INSERT INTO myTable99(Machine_ID)
    SELECT 1
    GO
    
    
    sp_Help myTable99
    GO
    
    DROP TABLE myTable99
    GO
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

Posting Permissions

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