Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2011-02-18
7
Medium Priority
?
894 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 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 61

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 61

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
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.

 

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 61

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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Loops Section Overview

772 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