Solved

VB.net SQL - Select items using LIKE

Posted on 2013-12-28
2
772 Views
Last Modified: 2013-12-28
Hi

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
0
Comment
Question by:murbro
2 Comments
 
LVL 74

Accepted Solution

by:
käµfm³d   👽 earned 500 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.
0
 

Author Closing Comment

by:murbro
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
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Viewers will learn how the fundamental information of how to create a table.

708 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now