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 2000 Forums
 SQL Server Development (2000)
 Adding Custom Fields to Tables

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-05-15 : 09:45:58
Costin writes "Ok, here's the situation. I want to be able to have a table that stores information about a certain item, such as a User. Now this user table, may be used by different companies to store information about their users, so I have a Company table, and I store the CompanyID in the User record. I need each company to be able to specify additional fields that a User might have, such as Height, Weight, Hair Color, etc, that are not in the User table. And I have done this by adding a couple of tables, called UserCustomField, which stores the CompanyID, CustomFieldID and CustomFieldLabel (ie Height), and a table called UserCustomFieldValue, which contains the UserID, CustomFieldID, and CustomFieldValue, which is a varchar value for that custom field for a specific user. So then I can add custom fields, for each company, so that their Users have customized properties. Now here's the question:

Can I generate a query that will return a recordset for which I have the general user info, and the custom fields, all in one row. I can do it in a join, on a per user basis, but I can't figure out how to get a list of all the users, and all their custom values all in one recordset. Any help would be greatly appreciated. Thank you!

Costin Tuculescu"
   

- Advertisement -