Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2011-02-18
7
Medium Priority
?
890 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
7 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 600 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 59

Assisted Solution

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

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

Assisted Solution

by:HainKurt
HainKurt earned 900 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
Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

 

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 59

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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

688 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