sql server - Creating dynamic view? -


i working in database stores park information in table. table lists park names , components of parks , ids of component types. below...

"parkname", "componentname", "componentid", "componenttypeid" -------------------------------------------------------------- smith park, north slide, 1, 12 smith park, south slide, 2, 12 smith park, swing set a, 3, 14 smith park, swing set b, 4, 14 adams park, east slide, 5, 12 adams park, west slide, 6, 12 adams park, swing set a, 7, 14 adams park, swing set b, 8, 14 adams park, sandbox a, 9, 15 adams park, sandbox b, 10, 15 

the attributes of each component type stored in own table following...

dbo.attributes_12 dbo.attributes_14 dbo.attributes_15 

the attributes in each table different, have 4 common fields - "componentname", "componentid", "year constructed" , "comments"

i did not create database, i'd able create view lists each park components , attributes of each component. like

"parkname", "componentname", "componentid", "componenttypeid", "year constructed", "comment" smith park, north slide, 1, 12, 1999, 'slide comment 1' smith park, south slide, 2, 12, 1999, 'slide comment 2' smith park, swing set a, 3, 14, 2006, 'swing set comment 1' smith park, swing set b, 4, 14, 2008, 'swing set comment 2' adams park, east slide, 5, 12, 2006, 'needs repair' adams park, west slide, 6, 12, 2004, 'ladder broken' adams park, swing set a, 7, 14, 2009, 'in shape' adams park, swing set b, 8, 14, 2010, 'chain needs replacing' adams park, sandbox a, 9, 15, 2001, 'needs new sand' adams park, sandbox b, 10, 15, 2002, 'in shape' 

is there "dynamic" way this?

what i'm struggling how join various attribute tables without manually adding them (ie through sort of sql code). there can many types of components in park beyond swing sets , slides (ie lights, benches, ponds, ornamental trees, garbage cans, signs, etc) , manually adding attribute tables view become cumbersome , not efficient if new type of component added.

i'm hoping can provide suggestions, maybe i'm trying isn't possible.

carl


Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

java - Unable to make sub reports with Jasper -