VB.net SQL - Select items using LIKE

Posted on 2013-12-28
Medium Priority
Last Modified: 2013-12-28

I am trying to select any records in a table where the column Food_Desciption
contains the word "APPLE" but there is something wrong with my syntax below

Select * From Food Where [Food_Description] LIKE '*APPLE*' OR [Food_Description] LIKE '*APPLE*'

Ay the end of it I want the user to be able to enter any letter combination
Question by:Murray Brown
LVL 75

Accepted Solution

käµfm³d   👽 earned 2000 total points
ID: 39743908
Use percent symbols:

Select * From Food Where [Food_Description] LIKE '%APPLE%'

Open in new window

Stars work in Access. SQL Server uses percent symbols.

Author Closing Comment

by:Murray Brown
ID: 39743916
Thanks. The system of mine that i copiedm that from caters for Access and SQL. Copied the wrong part of the if statement. Thanka for pointing out my silly mistake

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

627 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question