none
Type uniqueidentifier is primary key and foreign key also RRS feed

  • Question

  • Hi Everyone

    Step 1: I  have a store procedure (sp1) -> with data.

     Step 2:  I created a store procedure, with Column TransactionID is the primary key and foreign key.

    But I don't understand , Cloumn TransactionID is the primary key and foreign key.  I used NewID() in Store Proceduce.

    I do not know how to handle. Expect people to help.

    Thanks all

    Saturday, January 28, 2012 7:15 AM

All replies

  • Hello chautt, I do not know what to say, because it is unclear to me what you are describing.  (Sorry about that.)  You talk about stored procedures, but since your question is about foreign keys and primary keys, scripting out the table definitions migh be more helpful.

    There is nothing preventing a Primary Key from also being a Foreign Key.  Since a Primary Key is unique, it restricts the number of rows to only 1.  (If I understand what you are describing.)

    Using NewID() is how you get a uniqueidentifier, so that is fine. 

    However, I am not able to make sense of the data you show.  The first line of the first graphic has the same TransactionID as the first line of the second graphic.  But the other IDs in the second graphic do not appear above.  What is being modeled here?  

    If you can explain with a few more details that might help someone help you.

    RLF

    Saturday, February 4, 2012 9:55 PM