Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Concatenate Tables starting with common prefix

Hi Everyone,

I have few tables in my data model which start with 'T_' .

I want to concatenate all the tables in my data model which have there names starting from 'T_'.

I tried the following code ,

F:

Load *

Resident [T_*];

But it's not working.

Please suggest if this can done or not. And if yes, then how.

Also don't suggest me to make a qvd of all and store them into a common folder and then extract them. As I have around 500 tables like that

Thanking you all in anticipation

Regards

Karunpreet

4 Replies
sunny_talwar

I think you will need to implement some kind of loop where you would use TableName() and TableNumber() function to concatenate all the tables starting with T into one table. I have never done this, but if nobody else provides a solution by the end of day today, I will try to get a sample together.

Best,

Sunny

cwolf
Creator III
Creator III

Hi Karunpreet,

let vTabCnt = NoOfTables()-1;

for i=0 to vTabCnt

    let vTabName = TableName($(i));

    if left('$(vTabName)',2)='T_' then

        if i=0 then

            RENAME Table [$(vTabName)] to NEWTABLE;

        else

            Concatenate(NEWTABLE)

            LOAD * Resident [$(vTabName)];

            DROP Table [$(vTabName)];

        end if

    end if

next

regards

Christian

Anonymous
Not applicable
Author

Thanks for the hint Sunny

Anonymous
Not applicable
Author

Christian,

Thanks for such a genius reply