November 10, 2006 at 8:01 am
I have two tables:
1. tblCarrier
2. tblUser
The table tblCarrier has a column OwnerId which is being looked up in table tblUser. How can I identify the key that is being used in table tblUser to do this lookup?
Here is what the table looks like:
CREATE TABLE [dbo].[tblusers](
[UserGuid] [uniqueidentifier] NOT NULL,
[LastName] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[FirstName] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[FullName] [varchar](100) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[AccountType] [int] NULL CONSTRAINT [DF_tblUsers_AccountType] DEFAULT ((0)),
[UserType] [varchar](3) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
)
November 10, 2006 at 8:12 am
I'll take a shot in the dark here and guess [UserGuid].
(Which field identifies the user? Can it be the UniqueIdentifier?
If you look at all the other fields you can see that each one, taken only by itself, could apply to more than one user. After all, how many John Smiths are there really?.
To be fair, there are probably not many in your company but it's a whole lot more compact to use a number than to repeat the fullname all over the place. What happens when a user gets married and changes his/her name?)
November 10, 2006 at 9:35 am
Is there no explicit FK defined?
If this occurs in an app, use Profiler to check the queries being run
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply