sep 11 Microsoft CRM SQL Reports T-SQL

Check if file excist in SQL report


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

Share on FacebookTweet about this on TwitterShare on LinkedInShare on Google+

Skriv et svar

Din e-mailadresse vil ikke blive offentliggjort. Krævede felter er markeret med *