Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
GrantsV
Starting Member
1 Post |
Posted - 2009-11-12 : 06:15:24
|
Hi, I'll try to explain this the best I can!I have 10 tables in an invoice system, e.g. Products, Suppliers, Transactions etc. Each table entry can have zero to many Notes attached to it. I am struggling to design this.I have created a new table called Notes, with fields: ID, Note... but how would I link the Note to the corresponding table?e.g. Products table row 22 has a Note attached, then Suppliers table row 5 has two Notes attached etc.Thanks for any advice! |
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2009-11-12 : 07:23:47
|
It depends.If the IDs are unique over all tables Products, Suppliers, Transactions etc. then you can have that ID as a foreign key column in table notes.Else you may need a second column that holds the related tablename or so. No, you're never too old to Yak'n'Roll if you're too young to die. |
|
|
Lumbago
Norsk Yak Master
3271 Posts |
Posted - 2009-11-12 : 09:54:18
|
Do you need to link notes-table to the "other" tables though? Can't you just have a NoteID column in each of your other tables and that's it? I wouldn't think that the notes-table by itself is of any use without the product/supplier/etc context...- Lumbagohttp://xkcd.com/327/ |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2009-11-12 : 09:58:38
|
quote: Originally posted by Lumbago Do you need to link notes-table to the "other" tables though? Can't you just have a NoteID column in each of your other tables and that's it? I wouldn't think that the notes-table by itself is of any use without the product/supplier/etc context...- Lumbagohttp://xkcd.com/327/
...then Suppliers table row 5 has two Notes attached... No, you're never too old to Yak'n'Roll if you're too young to die. |
|
|
Lumbago
Norsk Yak Master
3271 Posts |
Posted - 2009-11-12 : 10:08:58
|
Crap...it's been a really long day. Just forget what I said (and thx webfred )- Lumbagohttp://xkcd.com/327/ |
|
|
mandow_4u
Starting Member
1 Post |
Posted - 2009-11-21 : 23:30:59
|
hi you can use table like ExtraDetails Table which hold the Id of Products and the Id of notes Table |
|
|
|
|
|