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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 relation between two tables

Author  Topic 

Exir
Posting Yak Master

151 Posts

Posted - 2009-08-30 : 04:18:47
Hi
Is it better to save name of users in a separate table and use their Id as foriegn key in my main Table or directly insert their name in my main table?

If it is better to have it in two table, when i want to show my main table in a grid, some numbers are shown instead of their names and its not good, i want to have their names in the grid

please guide me

LoztInSpace
Aged Yak Warrior

940 Posts

Posted - 2009-08-30 : 08:28:50
It depends on what is in your 'main' table.
It sounds like you are getting confused about data & presentation though. If you split it out you need to join back to the name of course.
Go to Top of Page

Exir
Posting Yak Master

151 Posts

Posted - 2009-08-30 : 12:53:06
Every user fill a form , and the data saves in the main table,the main table should shows that each row was inserted by who, so it needs the user name or its id.
now i dont know if it is better to use the user names or ids or no difference.
I hope i could express the problem
Go to Top of Page

IncisiveOne
Starting Member

36 Posts

Posted - 2009-08-30 : 13:39:41
You still haven't posted the DDL.

Save the column xxx as suser_id(). When selecting, retrieve it as suser_name(xxx).

Anything worth doing, is worth doing right.
Go to Top of Page
   

- Advertisement -