Parameter wildcard % query using ODCB to SQL database

sa1martin

New Member
Joined
Jun 9, 2011
Messages
1
I am using Excel 2007 MS Query with an ODBC database query to a SQL database

I have successfully set-up the parameter query. When I enter the full and complete part number containing text, numbers and characters, the query works perfectly. No results are returned when I enter a partial number.

I have tried using with and without a wildcard character in the parameter entry window.

I am using the following query LIKE ’%’+[Enter part number]+’%’

Example: searching for part number “12345-890” then results returned as expected. When I enter 345, %345% or *345* nothing is returned.

I have swapped out “*” for “%” using 1 and two quotes. I have also tried '&' instead of "+"Sometimes I get a varchar/nchar error, most of the time it is a syntax error

However, I did discover that when I copy the same formula into the customer name field which is all alpha characters it works correctly.

I'm thinking it has to do with being a text field verses a mixed model character set having text, numbers and characters. Would this make a difference and if so, how would I correct it?
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney

Forum statistics

Threads
1,214,652
Messages
6,120,747
Members
448,989
Latest member
mariah3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top