PDA

View Full Version : Passing Parameter to Excel for SQL Report



Ursula
08-15-2008, 08:56 AM
hello

I have a SQL report built for MSCRM and it collect the data from the external excel source. It basically display all the rows from excel where there is a match on the company name.
The current code is
select *
from [Advisors$] where
([Name of Adviser group] = ? )

order by [Deal Date] desc
How can i change it so the sciprt uses 'contains' logic rather the '='? So it brings back all the rows where the 'KPMG' for emaple is contatined in the Name rather it is exactly KPMG
Many thanks,

Bob Phillips
08-15-2008, 09:10 AM
Have you tried CONTAINS?

Ursula
08-21-2008, 04:13 AM
I tried and it did not work hence the post here. It's not strictly a SQL code so i'm not sure what code to use to achieve 'CONTAINS' business logic

Bob Phillips
08-21-2008, 04:39 AM
In what way is it not strictly SQL, it certainly looks like it to me.

Ursula
08-21-2008, 05:22 AM
I'm a Project Manager so i trusted what i was told by my consultant, that this is not a SQL code as SQL code was not working to retrieve the data from the Excel spreadsheet in the reportr written from the SQL Server BI Development Studio and meant for the deployment to MS CRM

If i change the code to be CONTAINS i get the ODBC Excel Driver syntaxt error (missing operator) in query expression... ,

cheers

Bob Phillips
08-21-2008, 06:22 AM
It is SQL, but I was wrong in the phrase, it is not CONTAINS in SQL, it is LIKE. But to get Contains you need a wildcard which is % is SQL



select *
from [Advisors$] where
[Name of Adviser group] Like '%Ursula%'

order by [Deal Date] desc