Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 127
Default Cannot Get SQL Query to Work with "LIKE"

Excel 2003. I have a module that grabs some data from an SQL database using
an ADODB connection. If I use the following in the SQL query, it returns no
data:

(WHERE INVOICENUMBER LIKE 'MS*')

However, if I use the following, I get all the data I expect:

(WHERE INVOICENUMBER='MS' AND INVOICENUMBER<='MS9999999999999')

What am I doing wrong? How may I properly use the LIKE phrase? Thanks for
any help.
--
Dr. Doug Pruiett
Good News Jail & Prison Ministry
www.goodnewsjail.org
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Cannot Get SQL Query to Work with "LIKE"

Try using a % symbol instead of a * symbol

I bleieve * symbol is used with MS Access and % is used with SQL

"Chaplain Doug" wrote:

Excel 2003. I have a module that grabs some data from an SQL database using
an ADODB connection. If I use the following in the SQL query, it returns no
data:

(WHERE INVOICENUMBER LIKE 'MS*')

However, if I use the following, I get all the data I expect:

(WHERE INVOICENUMBER='MS' AND INVOICENUMBER<='MS9999999999999')

What am I doing wrong? How may I properly use the LIKE phrase? Thanks for
any help.
--
Dr. Doug Pruiett
Good News Jail & Prison Ministry
www.goodnewsjail.org

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Cannot Get SQL Query to Work with "LIKE"

You could try LIKE 'MS%', the like clause in SQL uses % instead of * but I
would have expected ADO to do the conversion for you.

"Chaplain Doug" wrote in message
...
Excel 2003. I have a module that grabs some data from an SQL database
using
an ADODB connection. If I use the following in the SQL query, it returns
no
data:

(WHERE INVOICENUMBER LIKE 'MS*')

However, if I use the following, I get all the data I expect:

(WHERE INVOICENUMBER='MS' AND INVOICENUMBER<='MS9999999999999')

What am I doing wrong? How may I properly use the LIKE phrase? Thanks
for
any help.
--
Dr. Doug Pruiett
Good News Jail & Prison Ministry
www.goodnewsjail.org



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 127
Default Cannot Get SQL Query to Work with "LIKE"

Thank you both for the help. God bless.
--
Dr. Doug Pruiett
Good News Jail & Prison Ministry
www.goodnewsjail.org


"Terry Aney" wrote:

You could try LIKE 'MS%', the like clause in SQL uses % instead of * but I
would have expected ADO to do the conversion for you.

"Chaplain Doug" wrote in message
...
Excel 2003. I have a module that grabs some data from an SQL database
using
an ADODB connection. If I use the following in the SQL query, it returns
no
data:

(WHERE INVOICENUMBER LIKE 'MS*')

However, if I use the following, I get all the data I expect:

(WHERE INVOICENUMBER='MS' AND INVOICENUMBER<='MS9999999999999')

What am I doing wrong? How may I properly use the LIKE phrase? Thanks
for
any help.
--
Dr. Doug Pruiett
Good News Jail & Prison Ministry
www.goodnewsjail.org




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
=SUBSTITUTE(C4,"~?#","") will this work to remove multiple string Raja Mahendiran S Excel Worksheet Functions 6 May 12th 10 09:10 PM
How do I "insert copied cells"? used to be "alt i e" still work Inserter Excel Worksheet Functions 1 February 14th 09 10:06 PM
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
pictures to work with "data" "sort" option arad Excel Discussion (Misc queries) 1 April 18th 06 09:15 PM
Why doesn't "Workbook.Range("myrange").value" work? Brad Patterson Excel Programming 0 July 9th 03 01:24 AM


All times are GMT +1. The time now is 12:12 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"