Dynamic Temp-table To Static With Varying Fields Count

Shubhrant

New Member
Hi All, need your help on a requirement. it goes like:
i have a delimited file with unknown numbers of columns. i can able to create a dynamic temp-table and populate entire data properly in that temp-table.
Now i want to copy all these records to a static temp-table which is nothing but a replica of the dynamic temp-table. Since the column count is unknown and it may vary based on the input file, so how to decide the static temp-table field counts and create the static temp-table.
 

Cringer

ProgressTalk.com Moderator
Staff member
Why do you now need to put the info into a static temp table? This will be very messy to solve as you will find it very hard to have the flexibility inherent in dynamic temp tables.
 

GregTomkins

Active Member
AFAIK, you don't 'create' static temp-tables, you 'define' them, at compile-time. So if you really need a static temp-table in this case, you'd need to do something kinda horrible; such as define it with an array of 2000 character fields, where 2000 is > the maximum number of columns that you ever expect to see. You'd end up with something just as verbose and prone to run-time mayhem as dynamic temp-tables. (Dynamic temp-tables are great, of course, but that is their downside).
 

Cringer

ProgressTalk.com Moderator
Staff member
You could do it with a static table where you have a line number, column name and column value. You create a new record for each column in your data, for each line, but I'm not sure how that would be beneficial over a dynamic query.
 
Top