Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I've been trying to load all tables from database
and creating QVDs automatically but not working properly.
If I add [] its getting an error and It working be fine if the table name has no spaces.
Suggest me on this where am wrong.
Tablelist:
LOAD*
Inline
[Tablename
Categories
Customers
Divisions
Order Details
Products
Shippers
Shipments
];
FOR i=1 to FieldValueCount('Tablename')
LET Vtable= FieldValue('Tablename',i);
SQL SELECT *
FROM [$(Vtable)];
SET VQvdPath= D:\Practice\Data\QVDS\;
STORE [$(Vtable)] into $(VQvdPath)[$(Vtable)].qvd(qvd);
NEXT
Any suggestions will be appreciated.
Can you try this:
FOR i=1 to FieldValueCount('Tablename')
LET Vtable = '[' & FieldValue('Tablename', $(i)) & ']';
$(Vtable):
SQL SELECT *
FROM $(Vtable);
SET VQvdPath= D:\Practice\Data\QVDS\;
STORE $(Vtable) into $(VQvdPath)$(Vtable).qvd(qvd);
NEXT
or
FOR i=1 to FieldValueCount('Tablename')
LET Vtable = '[' & FieldValue('Tablename', $(i)) & ']';
LET VtableStore = FieldValue('Tablename', $(i));
$(Vtable):
SQL SELECT *
FROM $(Vtable);
SET VQvdPath= D:\Practice\Data\QVDS\;
STORE $(Vtable) into $(VQvdPath)$(VtableStore).qvd(qvd);
NEXT
How about this:
Tablelist:
LOAD * Inline[
Tablename
Categories
Customers
Divisions
Order Details
Products
Shippers
Shipments
];
FOR i=1 to FieldValueCount('Tablename')
LET Vtable = '[' & FieldValue('Tablename', $(i)) & ']';
SQL SELECT *
FROM $(Vtable);
SET VQvdPath= D:\Practice\Data\QVDS\;
STORE $(Vtable) into $(VQvdPath)$(Vtable).qvd(qvd);
NEXT
Thanks Sunny but not working still its getting an error. PFB for your ref.
Did you also fix the i -> $(i)?
Also try this:
FOR i=1 to FieldValueCount('Tablename')
LET Vtable = FieldValue('Tablename', $(i));
SQL SELECT *
FROM $(Vtable);
SET VQvdPath= D:\Practice\Data\QVDS\;
STORE $(Vtable) into $(VQvdPath)$(Vtable).qvd(qvd);
NEXT
Yes! Its working fine if the table name has no spaces.
But what about Order Details table?
Would you be able to share the application?
PFB of your reference. !
So this for sure wasn't working:
FOR i=1 to FieldValueCount('Tablename')
LET Vtable = '[' & FieldValue('Tablename', $(i)) & ']';
SQL SELECT *
FROM $(Vtable);
SET VQvdPath= D:\Practice\Data\QVDS\;
STORE $(Vtable) into $(VQvdPath)$(Vtable).qvd(qvd);
NEXT
Above we have the square brackets and also $(i) instead of i?
Hi Satish,
try
SQL SELECT * FROM "$(Vtable)";
and
Store "$(Vtable)" ..........
Remove []
Regards,
Antonio