Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

LIKE only works with exact match in SQL 1

Status
Not open for further replies.

KisiOne

Programmer
Sep 6, 2003
6
AU
I am trying to use wildcards in SQL
here is the vb code
Dim viewSelectQuery As String = "SELECT " & field & " FROM Sales WHERE ProductCode LIKE ""????BLP*"""
here is what the query string looks like when program is run
"SELECT ProductCode, DateSold, TimeSold, QuantitySold, CostPrice, SoldPrice, PaymentMethod FROM Sales WHERE ProductCode LIKE "????BLP*""
nothing is returned
If I replace the "????BLP*" with an exact ProcductCode I get the rows that match that product code. Am I doing something wrong?
 
You came to SQL Sever from MS-Access, right?
:)

The percent-sign (%) is the wildcard character on ANSI-compliant databases.

Chip H.


If you want to get the best response to a question, please check out FAQ222-2244 first
 
I am populating a VB datagrid from MS access database. No luck with changing to %.
 
Sorry about that - thought you were using SQL Server.
Maybe someone else can help.

Chip H.


If you want to get the best response to a question, please check out FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top