Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2003

    Lightbulb Unanswered: MSDE UniqueIdentifier

    Ok, testing out MSDE (pretty cool) and trying to set up relationships. I have a primary key in one table with a datatype of uniqueidentifer. My question is, how do I join that to another table? No other field type seems to want to match!

    Any help greatly appreciated.

  2. #2
    Join Date
    Sep 2003
    The extremely Royal borough of Kensington, London
    You can only join tables (in theory) through a primary key - foreign key relationship.


    tableA(id, colA, colB)
    tableB(id, colC, colD)

    Select *
    from tableA ta
    tableB tb ON =
    Bessie Braddock: Winston, you are drunk!
    Churchill: And Madam, you are ugly. And tomorrow, I'll be sober, and you will still be ugly.

  3. #3
    Join Date
    Oct 2003
    Sorry, think I need to be more clear.

    Lets say I have two tables; Student and Teacher. A many to one relationship.

    In my Teacher table I have a primary Key or TeacherID which is a datatype of uniqueidentifier. In my Student table I have a foreign key called TeacherID.

    My question is, what datatype should I make the TeacherID foreign key in the Student table in order for a relationship to be created?

  4. #4
    Join Date
    Oct 2003

    Thumbs up Fixed it!

    For anyone else who encounters this problem...

    Don't use a data type of uniqueidentifier for your primary key. Use int and there is a field option to choose "identity". Make that yes and it will auto increment much like the autonumber in Access.

    Then you can use int as the foreign key too.

Posting Permissions

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