Thursday, January 7, 2016

Script to generate QVD's


Please find the below script:

 

//DB Conncetion

SET DayNames='Mon;Tue;Wed;Thu;Fri;Sat;Sun';

 

// #### DB COnnection #### This will be change if we have more DB's

OLEDB CONNECT TO [ConnectionString];

// ##### QVD Path ####### This will be change if we want to change the QVD folder path

SET vQVDFolderPath = 'qvdata' ;

 

// List of Tables, Here I am creating with InLine. You can Use txt file or excel file. This will be change

LIST_OF_TABLES:

LOAD * INLINE [

TABLENAME

SCHEMA.TABLE1

SCHEMA.TABLE2

] ;

// From This line, the script is static

// generate the Loop for each value in the LIST_OF_TABLES table

 

FOR i=1 to FieldValueCount('TABLENAME')

LET vTableName = FieldValue('TABLENAME',$(i)) ;

 

$(vTableName):

SELECT * FROM $(vTableName) ;

 

STORE $(vTableName) into [$(vQVDFolderPath)\$(vTableName).qvd] (qvd);

 

//QVD DETAILS info

QVDDETAILS:

LOAD '$(vTableName).qvd' AS QVD_NAME ,

       '$(vTableName)' AS SOURCE_TABLENAME,

       NoOfRows('$(vTableName)') AS NO_OF_ROWS

AutoGenerate 1 ;

 

DROP Table $(vTableName) ;

 

NEXT i

 

In the above script, just change the DB connection , QVD Path and List of Tables for the another QVD Generator qvw file.

 

No comments:

Post a Comment