Arg81
Well-known member
OK, another daft question (one of those early morning ones I think
)
I have a "documentation" table. All this does is store the document path as a link which can be displayed in a grid, and double clicked to be opened (all this is done using OpenFileDialog)
Now, the only things that get recorded, are;
Parent Table ID
Document Path
I thought I may get away with no primary key, I can insert new rows fines, and update existing ones (i.e. if someone changes file path), however I can't delete a row and realise this is cause VS doesn't like the table not having a primary key.
I've kinda been stuck in this scenario before. I'm not sure whats best to set as a key.
The relationship is a one-to-many : One Parent row can have multiple document links attached.
Do I;
(a) Create a DocumentRowID field in the Documentation table and set this as primary key & identity? Personally I see this as a "useless, non-needed" field, only used as an identity...(no other RowID from the parent will link back to a document path from another RowID..)
(b) Set both rowID and DocumentPath as a joint primary key? However a primary key can only be at max 900 bytes and my documentpath is set to this (stupid user's with very long folder listings on our shared network drive!) - I could probably drop to 890....(its varchar) as the RowID is an int @ 4 :- At least this way the "silly" users can't add the same document path more than once to a parent row...
(c) Neither of the above, quit what I'm doing as it's all wrong, go out and research into setting up SQL tables properly then come back realising I was a big noob
Ta!

I have a "documentation" table. All this does is store the document path as a link which can be displayed in a grid, and double clicked to be opened (all this is done using OpenFileDialog)
Now, the only things that get recorded, are;
Parent Table ID
Document Path
I thought I may get away with no primary key, I can insert new rows fines, and update existing ones (i.e. if someone changes file path), however I can't delete a row and realise this is cause VS doesn't like the table not having a primary key.
I've kinda been stuck in this scenario before. I'm not sure whats best to set as a key.
The relationship is a one-to-many : One Parent row can have multiple document links attached.
Do I;
(a) Create a DocumentRowID field in the Documentation table and set this as primary key & identity? Personally I see this as a "useless, non-needed" field, only used as an identity...(no other RowID from the parent will link back to a document path from another RowID..)
(b) Set both rowID and DocumentPath as a joint primary key? However a primary key can only be at max 900 bytes and my documentpath is set to this (stupid user's with very long folder listings on our shared network drive!) - I could probably drop to 890....(its varchar) as the RowID is an int @ 4 :- At least this way the "silly" users can't add the same document path more than once to a parent row...
(c) Neither of the above, quit what I'm doing as it's all wrong, go out and research into setting up SQL tables properly then come back realising I was a big noob

Ta!
Last edited: