Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
DB Engine
SQL ServerMSDESQL Server CE
Services
Analysis (Data Mining)Analysis (OLAP)DTSIntegration ServicesNotification ServicesReporting Services
Programming
CLRConnectivitySQLXML
Other Technologies
ClusteringEnglish QueryFull-Text SearchReplicationService Broker
General
Data WarehousingPerformanceSecuritySetupSQL Server ToolsOther SQL Server Topics
DirectoryUser Groups
Related Topics
MS AccessOther DB ProductsMS Server Products.NET DevelopmentVB DevelopmentJava DevelopmentMore Topics ...

SQL Server Forum / Services / Reporting Services / November 2005

Tip: Looking for answers? Try searching our database.

Multi value string parameters

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
deepu_t@hotmail.com - 01 Aug 2005 06:25 GMT
Hi all

I have a multi value drop down list and their values are a string data
type.

Label      Value
Blue        BL
Pink        PK

If I select more than one values the parameter value is sent as 'BL,
PK'

The stored procedure has a where clause

WHERE theColor IN (@SelectedColor)

This does'nt return the expected results from the stored procedure.
How do we make the reporting services pass 'BL','PK' instead of 'BL,
PK' to the stored procedure?
How do I make this work??

Thanks heaps!!
goodman93 - 01 Aug 2005 13:31 GMT
Try creating this function:

CREATE FUNCTION ParamsToTable( @delimString varchar(255) )
   RETURNS @paramtable TABLE ( Id int ) AS

BEGIN
   DECLARE @len int,@index int,@nextindex int
   SET @len = DATALENGTH(@delimString)
   SET @index = 0
   SET @nextindex = 0

   WHILE (@len > @index )
       BEGIN
           SET @nextindex = CHARINDEX(';', @delimString, @index)
           if (@nextindex = 0 ) SET @nextindex = @len + 2
           INSERT @paramtable
           SELECT SUBSTRING( @delimString, @index, @nextindex - @index )
           SET @index = @nextindex + 1
       END
   RETURN
END
GO

And then use this in a join statment.

Select * from table
join ParamsToTable(',', @SelectedColor)

> Hi all
>
[quoted text clipped - 18 lines]
>
> Thanks heaps!!
deepu_t@hotmail.com - 02 Aug 2005 00:21 GMT
Thanks for your reply.

Where do i write the statements
> Select * from table
> join ParamsToTable(',', @SelectedColor)

Would this be in the stored procedure?
Thanks again!!

> Try creating this function:
>
[quoted text clipped - 46 lines]
> >
> > Thanks heaps!!
Jack Truneh - 30 Nov 2005 19:16 GMT
Help!!! ,this works, but if i am accepting multivalue parameters from Asp.
net UI ,parameters are correctly initialized with the values(string[]) but
the report does not filer it on the values passed.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.