Wednesday, March 28, 2012

Parameter limitation

Lets say I have very simple report like "Select * from Clients where
ClientID IN (@.ID)". With @.ID as the parameter being sent to the report, how
can I make it accept multiple values like 1,2,3,4. If I define the @.ID
parameter as Integer, it will delete 1,2,3,4. If I define the parameter as
string, I will get an error converting varchar to Int. If I define the
parameter as Float, it will convert 1,2,3,4 to 1234.
Please help and thank you very much!
--HI ,
"Richard Cranium" <mgreco40@.hotmail.com> schrieb im Newsbeitrag
news:OXk9zDDGFHA.2824@.tk2msftngp13.phx.gbl...
> Lets say I have very simple report like "Select * from Clients where
> ClientID IN (@.ID)". With @.ID as the parameter being sent to the report,
> how can I make it accept multiple values like 1,2,3,4. If I define the @.ID
> parameter as Integer, it will delete 1,2,3,4. If I define the parameter as
> string, I will get an error converting varchar to Int. If I define the
> parameter as Float, it will convert 1,2,3,4 to 1234.
> Please help and thank you very much!
well, this wil not work because of the mix of datatypes, the IN () accepts
only the same datatype as the field before.
a workaorund could be to use a stored procedure and build your SQL like:
CREATE PROCEDURE dbo.myreport (@.ID varchar(100) ) AS
declare @.sql varchar(500)
set @.sql = 'select * from Clients where ClientID IN ( ' + @.ID + ')'
exec(@.sql)
what i don´t know, if this will work with the report...
(have to try, if rsvc accept the stored procedure with parameters...).
htht, Tony|||I had the same problem ..and I used a query like that:
="select * from clients where ClientId IN ("&Parameters!ID.Value & ")"
It's working...
Stella Maris
"Toni Pohl" <atwork43@.hotmail.com__nospam> escribió en el mensaje
news:O1U0BQDGFHA.1260@.TK2MSFTNGP12.phx.gbl...
> HI ,
> "Richard Cranium" <mgreco40@.hotmail.com> schrieb im Newsbeitrag
> news:OXk9zDDGFHA.2824@.tk2msftngp13.phx.gbl...
> > Lets say I have very simple report like "Select * from Clients where
> > ClientID IN (@.ID)". With @.ID as the parameter being sent to the report,
> > how can I make it accept multiple values like 1,2,3,4. If I define the
@.ID
> > parameter as Integer, it will delete 1,2,3,4. If I define the parameter
as
> > string, I will get an error converting varchar to Int. If I define the
> > parameter as Float, it will convert 1,2,3,4 to 1234.
> >
> > Please help and thank you very much!
> well, this wil not work because of the mix of datatypes, the IN () accepts
> only the same datatype as the field before.
> a workaorund could be to use a stored procedure and build your SQL like:
> CREATE PROCEDURE dbo.myreport (@.ID varchar(100) ) AS
> declare @.sql varchar(500)
> set @.sql = 'select * from Clients where ClientID IN ( ' + @.ID + ')'
> exec(@.sql)
> what i don´t know, if this will work with the report...
> (have to try, if rsvc accept the stored procedure with parameters...).
> htht, Tony
>

No comments:

Post a Comment