How can I pass parameters using MYSQL and MS Reporting Services

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

Later in the code I then use:
Where >= @Start and<= @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.

Who is Participating?
shorakConnect With a Mentor Commented:
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 >= @Start and<= @End with
Where >= ? and<= ?

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.

HwkrangerConnect With a Mentor Commented:
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.
DOHMHAuthor Commented:
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.
All Courses

From novice to tech pro — start learning today.