October 3, 2008 at 3:05 am
hi friends,
i have a doubt while creating database. can we have same column name as primary key in two different tables?
plz help me if u can.
Thanks in advance,
cheers,
ram.
October 3, 2008 at 3:28 am
Yes you can.
.
October 3, 2008 at 7:53 am
the logic behind it is that column1 in tablea as a PK and column1 in tableb as a PK are different because the tables are different.
the 'fullname', if you will, of each primary key is the name of the table plus the column name. No different than having the same table name in a different database on the same server.
Just helping with the thought process
October 3, 2008 at 11:17 am
the 'fullname', if you will, of each primary key is the name of the table plus the column name.
The name of the primary key is whatever you specify it to be and that name must be unique in the database. Default if not specified is PK__<Table Name> followed by a hash.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply