Hi PRTG Support,
We have a SQL sensor setup for monitoring one of our scheduled jobs. The sql script returns either '0' or ''1' based on the result of the job and then checks against the lookup setup for these boolean values (0 or 1).
0 = Failure 1 = Success
The script runs fine when I run it on the sql database and returns '1'. However, when I try to run it on SQLv2 (PRTG) it returns "No Valid Datatable found".
I have already read few KBs on the website and it suggested to remove the semicolons (;) from the sql script. I have already done it but no luck with it. The script is as follows:
--- DECLARE @date date=getdate(),@type varchar(50)='Upload',@Typename varchar(50)='Account',@status INT set @status =0 IF (SELECT COUNT(*) FROM (SELECT TS as RunTime FROM [adminlog] WHERE [Type] = @type AND Typename = @Typename AND ts > @date AND ( Action like 'Job started' OR Action like 'Finished: Uploads finished:%' OR Action like 'job Completed') ) rows) = 3 SET @status=1 SELECT @status --- The sensor id is: 265648 and the result is as follows: --------------- <prtg> <error>1</error> <text>No valid datatable was returned</text> </prtg> ---------------
Could you please advise as what has to be done to fix it? Thanks.