Does anyine have an example (strored proc or something) where you can dynamically name columns in a "select into statement" or "create table statement" based on certain criteria in a sql or something
I basically have 2 tables that are created from 2 diff. sql's . The first table contains a "change_key" and a "title" each change_key corresponding to a title and the other table just has data with each row diffrentiated by six columns that make up a composite primary key.
I need to create a brand new table as a fusion of these 2 tables and add new columns based on the different titles that exist in the first table. I will not know the amount of data (different titles) that will appear in the first table because this table is created as a result of the change_key inner joined with another table entirely. I believe I have to do this in a procedure...................PLS HELP!!!