Solved

How can I pass parameters using MYSQL and MS Reporting Services

Posted on 2009-05-11
3
1,799 Views
Last Modified: 2012-05-06
Normally when I create a report using Microsoft Reporting Services connected to a SQL 2005 database, I declare the parameters in the beginning of the code as follows:

Declare @Start datetime, @End datetime
Begin

Later in the code I then use:
Where tablename.date >= @Start and tablename.date<= @End

Now I'm connecting to an older MYSQL version 4.? database but I keep getting an error about syntax in the first line when I try declaring the parameter. I know the query works without the parameters but I don't know how to pass parameters in MYSQL. I could not find much help on this online either. The vendor I'm working with is using this MYSQL db so I have very limited control over what I can do on that database and/or server.

I really thought I was over the hump just getting MSRS to work with MYSQL but now this - any help is greatly appreciated.

Thanks
0
Comment
Question by:DOHMH
[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 Comments
 
LVL 9

Assisted Solution

by:Hwkranger
Hwkranger earned 100 total points
ID: 24358585
I'm not 100% certain on this, since I use MSSQL for everything, but I used to do MYSQL

Instead of declaring your variables inside of the SQL, just use them and hook them in SSRS to variables declared in SSRS.  I think you can do it that way, and SSRS will pass the variable values instead of the variables for you.
0
 
LVL 11

Accepted Solution

by:
shorak earned 400 total points
ID: 24362023
I think with reporting services, you have to use un-named parameters when using databases other than MS SQL.

I'm not sure if using global variables will work. What you may have to do is go down your mysql script and replace the @start and @end with ? and then in your  edit dataset properties in reporting services, select the parameters tab and map each ? to the correct corresponding report parameter that you have setup in the report.

In your script, delete the variable declaration part and then replace

Where tablename.date >= @Start and tablename.date<= @End with
Where tablename.date >= ? and tablename.date<= ?

In your edit dataset dialog box in reporting services, go to the Parameters tab and and you should see two rows, the first column will have ? in both rows and the other column will have something like =Parameters!Parameter1.value
Use the dropdown in that cell to select the correct report parameter. Do this to both rows. You will have to go to the report parameters screen and delete any unwanted report parameters that has been automatically created and you should be done.

Rob
0
 

Author Closing Comment

by:DOHMH
ID: 31580237
Thanks for Hwkranger for getting me thinking of how to do this and shorak for giving me the specifics. Just a note that I had to enter the ? because they were not already populated in the parameters tab.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Containers like Docker and Rocket are getting more popular every day. In my conversations with customers, they consistently ask what containers are and how they can use them in their environment. If you’re as curious as most people, read on. . .
This post contains step-by-step instructions for setting up alerting in Percona Monitoring and Management (PMM) using Grafana.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

739 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