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.
Author |
Topic |
learntsql
524 Posts |
Posted - 2012-02-02 : 00:38:18
|
Hi All,I have a table with almost 70 columns and each column represents one different property.table contains millions of records.Now my requirement is i have to write a query where each row display PropertyName and PropertyValuefor eg:output likeName -- ValueP1 -- 1000P2 -- 20.2...etc...Please guide me what is the best way to write to handle some millions of records.TIA. |
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
learntsql
524 Posts |
Posted - 2012-02-02 : 01:16:56
|
Thanks Tara,But not sure what is EAV design.Never worked before on this.Please guide me some more detailed way.TIA. |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2012-02-02 : 01:51:39
|
This table would turn into 3 tables, your main columns in the first table, list of attributes in another table, and in the third you'd have your linking data for the main table and the attribute table.Here's an example, a dumb example (have a headache and can't think clearly, lol):Person - PersonId, Name, EmailAttribute - AttributeId, AttributeNamePerson_Attribute - AttributeId, PersonId, ValueAttribute would have optional things like hair color. And then Person_Attribute would link the person to each of their attributes. So if a person had 30 extra attributes besides what's in the main table, then you'd have 30 rows in Person_Attribute for that PersonId.Hope that makes sense, and sorry for the stupid example. Heading to bed to get rid of this headache. Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/Subscribe to my blog |
|
|
learntsql
524 Posts |
Posted - 2012-02-02 : 02:01:38
|
Thanks Tara,I have to work on this as its new to me.If anyone worked on this kind of requirements please guide me.Thanks. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-02-02 : 10:24:33
|
quote: Originally posted by learntsql Thanks Tara,I have to work on this as its new to me.If anyone worked on this kind of requirements please guide me.Thanks.
I thought Tara's explanation was clear enoughWhats the part in which you want guidance on?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
|
|
|
|
|