Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
heid_f
Contributor III
Contributor III

Check if A Table contains a specific value in the columns

Hey all!

I need a script, what will export data from a mssql server once a day and saves this data into a qvd-file.

How can I check, whether the script runs today or not, while checking the existing data in the qvd-file?

 

In my Export from MSSQL I add a new column: today() as Date_Report

 

And before the Export from MSSQL there should be a Checkup, whether in the qvd-file exists any value (today) in the column Date_Report.

 

Here my actual code:

 

Tickets:
LOAD
	*
FROM
	[$(ExportPfad)Tickets.qvd] (qvd)
;


// HERE TO CHECK, WHETHER TO LOAD DATA FROM MSSQL OR NOT.

concatenate LOAD 
  ID,
  Status,
  ErfasstVonId, 
  InBearbVonId, 
  ErledigtVonId, 
  Datum,
  ErstellungsDatum_DT, 
  FaelligDatum_DT, 
  ErledigtDatum_DT, 
  Nummer,
  Tickettyp,
  MandNr,
  today() as Datum_Auswertung,
  ApplyMap('CRM_Status_Mapping', Status, 'None') As StatusBez
	;
SELECT 
  ID,
  Datum,
  ErfasstVonId,
  InBearbVonId,
  ErledigtVonId,
  Status,
  "ErstellungsDatum_DT",
  "FaelligDatum_DT",
  "ErledigtDatum_DT",
  Tickettyp,
  MandNr,
  Nummer
  FROM CRMU9.dbo."CRM_KM"
  WHERE CRMU9.dbo."CRM_KM".Status < '2';

// END OF CHECK

store Ticketsinto [$(ExportPfad)Tickets.qvd];

 

Thanks four your help! 

Labels (1)
1 Solution

Accepted Solutions
1 Reply
QFabian
Specialist III
Specialist III