January 28, 2010 at 2:31 am
Another 'newbie' question I'm afraid.
Is there a reason why SQL generates Key names such as FK__Datasourc__Conta__47DBAE45.
Is there any harm in me changing the name of the keys as I create them to, for example FK__Datasource__Contactid?
January 28, 2010 at 3:47 am
January 28, 2010 at 5:00 am
I can't say I've ever given any thought as to why MS names things the way it does (that way lies madness), but it probably generates some type of GUID for the end of it in order to create a unique name.
As to naming a FK - when you create it you can give it whatever unique name you wish. We specify the Foreign Key names here within our table-creation scripts and try to give them names that make it obvious what fields on which tables they are referring.
If you look at BOL for Create Table the example of foreign key implementation has a somewhat more user-friendly name than the example you have come across.
BrainDonor.
January 28, 2010 at 5:12 am
Thanks for the reply.
When I create a table I simply state "references OTHERTABLE(Field)". Thus generating a seemingly random FK name.
I'll check out BOL.
Thanks again!
January 28, 2010 at 5:22 am
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply