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 |
|
insanepaul
Posting Yak Master
178 Posts |
Posted - 2011-12-06 : 06:20:46
|
| The song table has songs written by many artists and the artists have written many songs so I'm using a linker table between them.Songs have their own id's eg 235a67y543 and so do artists in a similar format.My first question is if these id's were GUIDS or id's without letters then I wouldn't need to setup an identity seed.Second question is if I did setup an identity seed for these tables would I use the identity seed in the linker table or the guid's and Id's of the songs and artists.My feeling is that I should use Identity seeds but can't think why - is it for performance, readability? |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-12-06 : 06:46:06
|
| you will set up fields as identity in parent tables (song,artist) whereas in linker table they will not be identity. you will just make them not nullable type------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
insanepaul
Posting Yak Master
178 Posts |
Posted - 2011-12-06 : 07:04:24
|
Thanks for the reply which answers the parent tables.Can I just say that in the linker table I wouldn't be using identy seed. I would normally use the Id's from the parent tables but because both tables have unique guids and id's, the linker table could be qwer-1234-qwer, 123456 instead of 1,1eg linker table I would normally think consists ofSongId ArtistId1 11 2 2 13 1but because song and artist have their own uniques I could use this:SongId ArtistIdqwert-12345... 24356732rtyi-234-rt... 24356732quote: Originally posted by visakh16 you will set up fields as identity in parent tables (song,artist) whereas in linker table they will not be identity. you will just make them not nullable type------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/
|
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-12-06 : 07:10:36
|
| you can use any one of approaches. If you want, you can even add a new identity column in linker table and make it primary key instead of composite keys------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|