Solved

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

Posted on 2011-02-18
7
875 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 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
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 

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

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

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

Suggested Solutions

I have written a PowerShell script to "walk" the security structure of each SQL instance to find:         Each Login (Windows or SQL)             * Its Server Roles             * Every database to which the login is mapped             * The associated "Database User" for this …
     When we have to pass multiple rows of data to SQL Server, the developers either have to send one row at a time or come up with other workarounds to meet requirements like using XML to pass data, which is complex and tedious to use. There is a …
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

830 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