Solved

how to pass multiple values in the parameters in stored procedure to design reports

Posted on 2011-02-18
7
871 Views
Last Modified: 2012-06-27
i want to insert values in the following ststement

 exec DBSP_Report_GetProjectDetailCost1 @ProjectLettingDateFrom='01/01/2006',@ProjectLettingDateTo='01/01/2011',@DivisionName='Division description 2,division description 3'

but the attached stored proc wont take the values.How to correct the atatched stored proc to accept multiple values in the parameter @DivisionName.

I am building the reports based on this.Its urgent experts,please help
StoredProc.txt
0
Comment
Question by:sqlcurious
  • 3
  • 3
7 Comments
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 200 total points
ID: 34926751
this article shall help:
http://www.experts-exchange.com/A_1536.html

this part in your proc would do:
set @SQL= @Sql + ' And D.DivisionName in (select DivisionName from dbo.fneBid_SplitValue(''%'+@DivisionName+'%'',',')) '

so, what exactly is not working?
0
 
LVL 51

Assisted Solution

by:HainKurt
HainKurt earned 300 total points
ID: 34926923
try this:

 set @SQL= @Sql + ' And D.DivisionName LIKE ''%'+@DivisionName+'%'''
-->
 set @SQL= @Sql + ' And '',' + @DivisionName + ','' like ''%,'+D.DivisionName+',%'''
0
 
LVL 51

Assisted Solution

by:HainKurt
HainKurt earned 300 total points
ID: 34926949
when you run this

select DivisionName from dbo.fneBid_SplitValue('a,b,c,d',',')

what do you get? maybe we should use this function instead of the one I posted above... if this select does not work, run this and post the result

select * from dbo.fneBid_SplitValue('a,b,c,d',',')
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

Author Closing Comment

by:sqlcurious
ID: 34928780
--set @SQL= @Sql + ' And D.DivisionName in (select DivisionName from dbo.fneBid_SplitValue(''%'+@DivisionName+'%'',",")) '

i tried this one says
Invalid column name ','.

AND FOR THIS
 set @SQL= @Sql + ' And DivisionName in (select DivisionName from dbo.fneBid_SplitValue(''%'+@DivisionName+'%'',',')) '
 
SAYS

Incorrect syntax near ','.
0
 
LVL 51

Expert Comment

by:HainKurt
ID: 34928977
--set @SQL= @Sql + ' And D.DivisionName in (select DivisionName from dbo.fneBid_SplitValue(''%'+@DivisionName+'%'',",")) '
-->
--set @SQL= @Sql + ' And D.DivisionName in (select DivisionName from dbo.fneBid_SplitValue('''+@DivisionName+''','',''))'

0
 

Author Comment

by:sqlcurious
ID: 34929003
WHEN I TRIED THIS IT SAYS FOLLOWING MESSAGE

Msg 207, Level 16, State 1, Line 28
Invalid column name ','.
0
 

Author Comment

by:sqlcurious
ID: 34929053
select * from dbo.fneBid_SplitValue('a,b,c,d',',')

IT IS SHOWING EVERYTHING IM THE DIVISIONNAME.i WANT PARTICULAR DIVISION NAME

0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

SQL Server engine let you use a Windows account or a SQL Server account to connect to a SQL Server instance. This can be configured immediatly during the SQL Server installation or after in the Server Authentication section in the Server properties …
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now