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)
 Pivot table query

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-08-25 : 10:29:40
Rahul writes "Hi,

I have 3 tables first EmployeeTable which has 13 columns.
My user wants some extra columns to be added to the employeedetails table. In the second table (tblcolumnschema) user will enter i have the list of columns which user wants to append it to the employeedetails table.

In the third table user will enter the data for the newly added columns (tblcolumndata).

1. tblEmployeeTable
employeeid employeeName Designation Salary
1 John Manager 5000
2 Paul TL 4000

2. tblColumnSchema
columnId ColumnName DatatType
1 Comments varchar
2 Age int

3. tblColumnData
numrowId columnId value
1 1 important
2 1 good
1 2 35
2 2 30

I want to display the data in the following manner
employeeid employeeName Designation Salary Comments Age
1 John Manager 5000 important 35
2 Paul TL 4000 good 30"

snSQL
Master Smack Fu Yak Hacker

1837 Posts

Posted - 2006-08-25 : 14:50:03
Are you using this table layout because you acually want to allow each employee to have an unlimited number of details? If so, then you could potentially end up with 100s of columns, so you may want to rather have a list below each employee. If not then why don't you have the columns in the Employee table?
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-08-26 : 00:34:25
See if this helps
http://sqljunkies.com/WebLog/amachanic/archive/2004/11/10/5065.aspx?Pending=true


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -