I have two tables that I need to use to create a specific select statement.
One table (AllData) contains approx 45 columns and data in each column. The other table (ColumnList) holds the names of the columns and a flag.
What I need to do is create a select statement against AllData that will only use the columns indicated in ColumnList
Example
AllData table
ColumnNames:
FirstName
LastName
DOB
Gender
State
Zip
ColumnList Table
ColumnName Use
FirstName True
LastName True
DOB False
Gender True
Therefore my select statement would be something like
select FirstName, LastName from AllData
since the "Use" flag can change I need to make this dynamic
Hope this makes sense
One table (AllData) contains approx 45 columns and data in each column. The other table (ColumnList) holds the names of the columns and a flag.
What I need to do is create a select statement against AllData that will only use the columns indicated in ColumnList
Example
AllData table
ColumnNames:
FirstName
LastName
DOB
Gender
State
Zip
ColumnList Table
ColumnName Use
FirstName True
LastName True
DOB False
Gender True
Therefore my select statement would be something like
select FirstName, LastName from AllData
since the "Use" flag can change I need to make this dynamic
Hope this makes sense