Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

SSRS linked server to MySQL parameter problems Expand / Collapse
Author
Message
Posted Saturday, October 20, 2012 12:03 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, March 18, 2014 12:17 PM
Points: 4, Visits: 23
In SSRS 2008, I have a linked server setup to SugarCRM using the 64 bit Mysql ODBC connector. Openquery is not needed (and does not work) when setting up the query for the dataset. The query you define is passed directly to MySQL.

Example:
SELECT userid,state FROM SugarUsersTable WHERE state = 'MD'

This works fine. What doesn't work is attempting to pass any variable from SSRS to it.

This does not work:
SELECT userid,state FROM SugarUsersTable WHERE state = '@state'

This is very frustrating and I have not been able to find an alternate solution. I need this to be available via the SSRS reports menu for our Sales staff.
Post #1375119
Posted Saturday, October 20, 2012 6:26 PM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Friday, July 25, 2014 6:57 AM
Points: 1,163, Visits: 1,188
kmiles (10/20/2012)
In SSRS 2008, I have a linked server setup to SugarCRM using the 64 bit Mysql ODBC connector. Openquery is not needed (and does not work) when setting up the query for the dataset. The query you define is passed directly to MySQL.

Example:
SELECT userid,state FROM SugarUsersTable WHERE state = 'MD'

This works fine. What doesn't work is attempting to pass any variable from SSRS to it.

This does not work:
SELECT userid,state FROM SugarUsersTable WHERE state = '@state'

This is very frustrating and I have not been able to find an alternate solution. I need this to be available via the SSRS reports menu for our Sales staff.


What is the error you're getting? Is it returning no rows? Have you tried w/o the ticks/single quotes?
SELECT userid,state FROM SugarUsersTable WHERE state = @state


At a previous company we used SugarCRM on MySQL db and our reporting came out of SQL Server. I created a nightly job that pulled the data from the production MySQL db and populated the reporting db in SQL Server. It made reporting easier.

HTH,
Rob

Post #1375132
Posted Sunday, October 21, 2012 12:04 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, March 18, 2014 12:17 PM
Points: 4, Visits: 23
It returns no rows, with no errors, when passing the parameter. I tried it also without the quotes and nothing changed. I may have to do as you suggested and make a local SQL copy but our SugarCRM database is pretty large and I was hoping to avoid the duplication.

Thanks for input Rob.
Post #1375146
Posted Sunday, October 21, 2012 12:47 PM


SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Today @ 1:57 AM
Points: 91, Visits: 163,984
kmiles (10/21/2012)
It returns no rows, with no errors, when passing the parameter. I tried it also without the quotes and nothing changed. I may have to do as you suggested and make a local SQL copy but our SugarCRM database is pretty large and I was hoping to avoid the duplication.


One "work-around" I can think of is that you can build the expression for the query in SSRS dynamically (using the 'fx' button next to the expression box).

So instead of passing the parameters, you could build an expression that embeds the parameters in the query.

Would that solve your problem?



-----------------
... Then again, I could be totally wrong! Check the answer.
Check out posting guidelines here for faster more precise answers.

I believe in Codd
... and Thinknook is my Chamber of Understanding
Post #1375198
Posted Sunday, October 21, 2012 4:42 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, March 18, 2014 12:17 PM
Points: 4, Visits: 23
That seemed like it would be a great solution but nothing is being evaluated prior to sending the query text directly to MySQL. Even typing in the expression box for the dataset query ="select..." returns a MySQL syntax error that it doesn't understand the beginning ="

This would explain why the parameters are not working becasue SSRS is not evaluation the @param, it's just sending the text "@param".

Thanks for the help, any other thoughts?
Post #1375214
Posted Sunday, October 21, 2012 10:51 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, March 18, 2014 12:17 PM
Points: 4, Visits: 23
ib.naji (10/21/2012)
kmiles (10/21/2012)
It returns no rows, with no errors, when passing the parameter. I tried it also without the quotes and nothing changed. I may have to do as you suggested and make a local SQL copy but our SugarCRM database is pretty large and I was hoping to avoid the duplication.


One "work-around" I can think of is that you can build the expression for the query in SSRS dynamically (using the 'fx' button next to the expression box).

So instead of passing the parameters, you could build an expression that embeds the parameters in the query.

Would that solve your problem?



Using the filter option in the dataset worked. I was typing "@parameter" in the filter field instead of "=Parameters!State.Value". Thanks for your help!
Post #1375247
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse