Solved

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

Posted on 2011-02-18
7
869 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
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 

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

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Join & Write a Comment

Suggested Solutions

Naughty Me. While I was changing the database name from DB1 to DB_PROD1 (yep it's not real database name ^v^), I changed the database name and notified my application fellows that I did it. They turn on the application, and everything is working. A …
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

707 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

15 Experts available now in Live!

Get 1:1 Help Now