Quantcast
Channel: SQL Server Reporting Services, Power View forum
Viewing all articles
Browse latest Browse all 10045

SSRS 2012 - the multiple-value parameter managing depends on the type of query

$
0
0

SQL Server 2012 - 11.0.2218.0 Enterprise Evaluation Edition (64-bit) on Windows NT 6.1 <X64> (Build 7601: Service Pack 1) (Hypervisor)
I verified onto my SSRS that a multiple-value parameter is managed differently depending on the query type used in the dataset.
Report builts using VS10 (monolithic server, ssdb, ssrs, developping, all-in-one)

Here is a brief proof of concept:

The parameters are defined in the report as:
CLICOD, integer, no nulls, allow multiple values
FROM_DATE, datetime, no null, no multiple values
[the FROM_DATE is just for comparison, CLICOD is the troublesome)

The select use the parameters in the where clause, let's say: "WHERE CLICOD IN (@CLICOD) ANDORDDAT=@FROM_DATE"

Here is the running code sniffed via Profiler:


Dataset query type:

Text:
exec sp_executesql N'SELECT * FROM myTAB WHERE CLICOD IN (1,2,3) AND ORDDAT=@FROM_DATE',N'@FROM_DATE datetime',@FROM_DATE='2013-02-01 00:00:00'
Great. The CLICOD (only) had been directly substituted in the source allowing the multiple value in the IN clause.

Stored Proc:
exec SSRS_sp_MCInsurers @CLICOD=N'1,2,3',@FROM_DATE='2013-02-01 00:00:00'
The CLICOD gets a string! And of course the db engine starts swearing and fires an exception

Of course I'd like to go through the sp way... any hints?

pf


Viewing all articles
Browse latest Browse all 10045

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>