473,399 Members | 4,192 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Query build

I am having trouble with structuring my query for searching using "LIKE". I
return no records with my current SQL statement. Any suggestions would be
appreciated.

Here is the string I am sending through ASP using VBScript as my language.

Other piece:
strClass = Request("SiteLOCCode")

String from ASP page:
"SELECT * FROM LDSWSNames WHERE WSName LIKE '" & strClass & "' "

Output string from ASP:
SELECT * FROM LDSWSNames WHERE WSName LIKE 'KYLEXAD01'


Jul 19 '05 #1
2 1806
grw
You may want to use the wildcard (%) :

"SELECT * FROM LDSWSNames WHERE WSName LIKE '%" & strClass & "%'"

This will find all records containing *KYLEXAD01*

"SELECT * FROM LDSWSNames WHERE WSName LIKE '" & strClass & "%'"

This will find all records starting with KYLEXAD01*

"SELECT * FROM LDSWSNames WHERE WSName LIKE '%" & strClass & "'"

This will find all records ending with *KYLEXAD01

"Larry R. Baker" <lb****@eaglestrike.net> wrote in message
news:#5**************@TK2MSFTNGP10.phx.gbl...
I am having trouble with structuring my query for searching using "LIKE". I return no records with my current SQL statement. Any suggestions would be
appreciated.

Here is the string I am sending through ASP using VBScript as my language.

Other piece:
strClass = Request("SiteLOCCode")

String from ASP page:
"SELECT * FROM LDSWSNames WHERE WSName LIKE '" & strClass & "' "

Output string from ASP:
SELECT * FROM LDSWSNames WHERE WSName LIKE 'KYLEXAD01'


Jul 19 '05 #2
Thanks, last night I totally blanked and could not remember the wildcard for
the end "%' and it worked great.

Again thanks to both of you.

Larry
"grw" <no**@none.com> wrote in message
news:Ov**************@TK2MSFTNGP12.phx.gbl...
You may want to use the wildcard (%) :

"SELECT * FROM LDSWSNames WHERE WSName LIKE '%" & strClass & "%'"

This will find all records containing *KYLEXAD01*

"SELECT * FROM LDSWSNames WHERE WSName LIKE '" & strClass & "%'"

This will find all records starting with KYLEXAD01*

"SELECT * FROM LDSWSNames WHERE WSName LIKE '%" & strClass & "'"

This will find all records ending with *KYLEXAD01

"Larry R. Baker" <lb****@eaglestrike.net> wrote in message
news:#5**************@TK2MSFTNGP10.phx.gbl...
I am having trouble with structuring my query for searching using "LIKE".
I
return no records with my current SQL statement. Any suggestions would

be appreciated.

Here is the string I am sending through ASP using VBScript as my language.
Other piece:
strClass = Request("SiteLOCCode")

String from ASP page:
"SELECT * FROM LDSWSNames WHERE WSName LIKE '" & strClass & "' "

Output string from ASP:
SELECT * FROM LDSWSNames WHERE WSName LIKE 'KYLEXAD01'



Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: MichaelC | last post by:
Hi all, I'm a newbie to SQL and I need help with investigating what ways are possible to build an interface of some sort that wraps around a SQL query script. I have a simple SQL query which...
3
by: John young | last post by:
I have been looking for an answer to a problem and have found this group and hope you can assist . I have been re doing a data base I have made for a car club I am with and have been trying to...
2
by: Seth Delaney | last post by:
I have a form with multiple unbound text boxes which serves as a "search form". I can enter my search parameters in the various boxes as needed and click okay. My records are then filtered to...
0
by: starace | last post by:
I have designed a form that has 5 different list boxes where the selections within each are used as criteria in building a dynamic query. Some boxes are set for multiple selections but these list...
7
by: smith_lannynospam | last post by:
I was wondering if it is possible to create simple queries with the data included in the select statement, similar to how you use the word VALUES (x1,x2,...) in in INSERT statement. The reason I...
1
by: jpatchak | last post by:
Hi Guys, Sorry if this is a really stupid question. I am trying to upsize my Access database to SQL server. When I used the Access upsizing wizard, some of my queries didn't get upsized so I am...
9
by: Kelii | last post by:
I've been trying to get this piece to work for a few hours, but have given up. I hope someone out there can help, I think the issue is relatively straightforward, but being a novice, I'm stumped....
5
by: deaconj999 | last post by:
Hi, I have nearly finished my database and I would like to add a query that uses a combo box to get the results, not the usual paramater style input. I suppose it would need a form and a query...
3
by: mnjkahn via AccessMonster.com | last post by:
I'm running Access 2003, modifying a query that has over 45 fields. When I right click on the field name in Query Design View, and then click Build, Access crashes before the Build window...
1
by: zoro25 | last post by:
Hi, Maybe my question is dumb, but I'm not sure what is the best approach. I need to build a report and the data is stored in many tables and queries (8 or 9) and I'm wondering if I should build...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.