473,320 Members | 1,953 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,320 software developers and data experts.

Where clause

sSQL = "SELECT *" & _
" FROM 06_Statements" & _
" WHERE [Billing Date] = '23-DEC-2005'" & _
" And [Total Charge] > 0" & _
" AND Description LIKE'Cellular" & "*" & "'" & _
" ORDER BY [Service Number]"
set rs = Connect.Execute(sSQL)

Can someone tell me what's wrong wth this?
" AND Description LIKE'Cellular" & "*" & "'" & _

I've also tried
" AND Description LIKE'Cellular*'" & _
as well as other versions.

This works find but I need to grab other things with "Cellular" in
them.
" AND Description LIKE'Cellular Roaming Charges'" & _

Feb 7 '06 #1
1 1655
ey****@ncsa.uiuc.edu wrote:
sSQL = "SELECT *" & _
" FROM 06_Statements" & _
" WHERE [Billing Date] = '23-DEC-2005'" & _
" And [Total Charge] > 0" & _
" AND Description LIKE'Cellular" & "*" & "'" & _
" ORDER BY [Service Number]"
set rs = Connect.Execute(sSQL)

Can someone tell me what's wrong wth this?
" AND Description LIKE'Cellular" & "*" & "'" & _

I've also tried
" AND Description LIKE'Cellular*'" & _
as well as other versions.

This works find but I need to grab other things with "Cellular" in
them.
" AND Description LIKE'Cellular Roaming Charges'" & _

When running queries via ADO, you must use ODBC wildcards (% and _) instead
of (* and ?) regardless of what database backend you are using.

Having said that, your use of dynamic sql is leaving you open to hackers
using sql injection as well as performance impairment. You should consider
using parameters instead:
http://groups-beta.google.com/group/...e36562fee7804e
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Feb 7 '06 #2

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

Similar topics

47
by: Andrey Tatarinov | last post by:
Hi. It would be great to be able to reverse usage/definition parts in haskell-way with "where" keyword. Since Python 3 would miss lambda, that would be extremly useful for creating readable...
2
by: steve | last post by:
To gain performance, do I need to index ALL the fields in the where clause. Say we have a query like: select stuff from table where field1=.. and field2=... If field1 selection substantially...
3
by: A.V.C. | last post by:
Hello, I found members of this group very helpful for my last queries. Have one problem with CASE. I can use the column name alias in Order By Clause but unable to use it in WHERE CLAUSE. PLS...
0
by: jobs | last post by:
I have a gridview that times when selecting from specific table when I try to when I add a where clause. Even when I'm only seleting Top 1 which comes right back at the command line. I test the...
2
by: Jim.Mueksch | last post by:
I am having a problem with using calculated values in a WHERE clause. My query is below. DB2 gives me this error message: Error: SQL0206N "APPRAISAL_LESS_PRICE" is not valid in the context where...
9
by: Emin | last post by:
Dear Experts, I have a fairly simple query in which adding a where clause slows things down by at least a factor of 100. The following is the slow version of the query ...
8
by: chrisdavis | last post by:
I'm trying to filter by query or put those values in a distinct query in a where clause in some sort of list that it goes through but NOT at the same time. Example: ROW1 ROW2 ROW3 ROW4 ,...
5
by: pwiegers | last post by:
Hi, I'm trying to use the result of a conditional statement in a where clause, but i'm getting 1)nowhere 2) desperate :-) The query is simple: -------- SELECT idUser,...
4
by: Jane T | last post by:
I appreciate how difficult it is to resolve a problem without all the information but maybe someone has come across a similar problem. I have an 'extract' table which has 1853 rows when I ask for...
12
by: =?ISO-8859-1?Q?Ren=E9?= | last post by:
Hi, is there a rule of thumb what is better/faster/more performant in SQL Server 2005? a) SELECT * FROM A INNER JOIN B ON B.ID = A.ID AND B.Cond1 = 1 AND B.Cond2 = 2 b) SELECT * FROM A INNER...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.