Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I want to know no. of records and field names in each table extracted before storing and dropping them or even put tables with 0 records into a new folder.
As there are many table in DB and many are blank it becomes hard doing it manually. I want no. of records and field names as it makes discussion easier as sometimes client is still developing and creates table for future.
ListofTable:
SELECT
TABLE_NAME AS TableName,
Table_schema
from information_schema.tables where table_schema='school';
for i=0 to NoOfRows ('ListofTable')-1
let vTableName=Peek('TableName',$(i),'ListofTable');
$(vTableName):
SQL SELECT * from
school.$(vTableName);
Store $(vTableName) Into [lib://Extraction/School/$(vTableName).qvd] (qvd);
Drop Table $(vTableName);
//
next
Exit Script;
Like you pull the existing tables from the database system-tables you could also read the number of records and fields from there. Personally, I wouldn't be surprised if this information is within the same schema-table. The help and/or the community from your database should provide all needed details - whereby a:
Select * from information_schema.tables;
will return all fields from the table and a quick check with a tablebox on this data will help to find the needed information - and with it you could extend the where-clause.
- Marcus