

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Rename Table Name before storing
Hello,
I have the script below which is reading the table names from Tables and then assigning while loading from sql. The script is working fine.
Now I need to rename table5 to Table6
table4 to Table7
before Storing them.
The original script without the renaming which works.
Tables:
Load * Inline [name
table1
table2
table3
table4
table5
];
For i = 0 to NoOfRows('Tables')-1
Let TN = Peek('name',$(i),'Tables');
TRACE Processing File: $(TN).qvd;
$(TN):
LOAD*;
SQL SELECT *
FROM $(TN);
STORE $(TN) into $(vQVDExtractPath)Tables_$(TN).qvd (qvd);
Drop Table $(TN);
Next i;
The script with the renaming which is not working.
Tables:
Load * Inline [name
table1
table2
table3
table4
table5
];
For i = 0 to NoOfRows('Tables')-1
Let TN = Peek('name',$(i),'Tables');
TRACE Processing File: $(TN).qvd;
$(TN):
LOAD*;
SQL SELECT *
FROM $(TN);
Let StoreName = If(Match($(TN),'table4'),'Table7',
If(Match($(TN),'table5'),'Table6',$(TN)));
STORE $(TN) into $(vQVDExtractPath)Tables_$(StoreName ).qvd (qvd);
Drop Table $(TN);
Next i;
How could this be achieved?
- Tags:
- renametable
Accepted Solutions


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
OK I got it to work. was just missing quotes on the variable names.
Tables:
Load * Inline [name
table1
table2
table3
table4
table5
];
For i = 0 to NoOfRows('Tables')-1
Let TN = Peek('name',$(i),'Tables');
Let StoreName = If(Match('$(TN)','table4'),'Table7',
If(Match('$(TN)','table5'),'Table6','$(TN)'));
TRACE Processing File: $(TN).qvd;
$(TN):
LOAD*;
SQL SELECT *
FROM $(TN);
STORE $(TN) into $(vQVDExtractPath)Tables_$(StoreName ).qvd (qvd);
Drop Table $(TN);
Next i;


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
OK I got it to work. was just missing quotes on the variable names.
Tables:
Load * Inline [name
table1
table2
table3
table4
table5
];
For i = 0 to NoOfRows('Tables')-1
Let TN = Peek('name',$(i),'Tables');
Let StoreName = If(Match('$(TN)','table4'),'Table7',
If(Match('$(TN)','table5'),'Table6','$(TN)'));
TRACE Processing File: $(TN).qvd;
$(TN):
LOAD*;
SQL SELECT *
FROM $(TN);
STORE $(TN) into $(vQVDExtractPath)Tables_$(StoreName ).qvd (qvd);
Drop Table $(TN);
Next i;
