Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I'm wondering, when I do a SQL query, how can I configure an different outcome based on the resulting row count?
In other words, return different status codes (using the tRESTresponse) based on the query outcome (rows returned vs. none).
Br,
Tom
NB_LINE may be not very effective if number of rows big - before return number of rows Talend will receive all data from server
I prefer use SQL construction tMSSQLRow, like
SELECT CASE WHEN EXISTS (SELECT id FROM t1) THEN 1 ELSE 0 END AS check_result
return 1/0
or
SELECT CASE WHEN EXISTS (SELECT id FROM t1) THEN (SELECT count(*) as cnt FROM t1) ELSE 0 END AS cnt
return number of rows