Hi Kirsten,
Do you just mean something like:
SELECT PropertyType,
MAX(CASE WHEN Attribute = 'Name' THEN Value END)
AS Name,
MAX(CASE WHEN Attribute = 'Age' THEN Value END)
AS Age,
MAX(CASE WHEN Attribute = 'Haircolour' THEN Value END)
AS Haircolour
FROM dbo.Properties
GROUP BY PropertyType;
Regards,
Greg
Dr Greg Low
1300SQLSQL (1300 775 775) office | +61 419201410 mobile│ +61 3 8676 4913 fax
SQL Down Under | Web: <http://www.sqldownunder.com/> www.sqldownunder.com
From: [email protected] [mailto:[email protected]]
On Behalf Of Kirsten Greed
Sent: Monday, 16 December 2013 10:00 AM
To: 'ozDotNet'
Subject: creating entities from rows instead of columns
Hi All
I have a table called Properties with fields
PropertyName nVarchar(80)
PropertyValue nVarchar(max)
PropertyType int
I want to be able to create an entity from it, similar to the way Entity
Framework creates entities from table definitions.
Are there any tools out there to do this?
Thanks
Kirsten