I needed a script to check if a picture file excist for use in my data set.
This is the normal SQL script:
But that will not work from inside the report manager, but if you build it into a function on the sql server it will work.
Normally when I build my own functions I put them into their own database, so I don’t loose it by a mistake.
So create a new database and create a new scalar-valued function, this is the script for it:
Now you will be able to call it from inside your report with this statement:
(SELECT crm_functions.dbo.CheckFile(CRMAF_FilteredAccounts.number, N'1.jpg') AS CheckFile) AS CheckFile1