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

SQL query: check for uppercase (UCASE?) in a value

Hi all,

I'm trying to make a SQL query (against a table in MS Access) where I
want to take the value of something, and check to see if the first two
letters in that value are capitalized (for importing purposes later
on!). For example:

re_200_3 <-- I want this to be returned because the "re" isn't
uppercase.
RE_200_2 <-- This value would be fine because it *is* uppercase.

So, my question, would I be able to treat the value as a String in
this query and return the value that does not have just the first two
letters uppercase? I was thinking about possibly using a TRIM
function to possibly drop everything after the '_', but I'm not sure
that's possible. (If only I was doing this in VB I could create an
array...etc...but c'est la vie). I've done a bit of research and seen
people use functions such as UCASE and CHECK, but for some reason I
doubt this will work in my case. Is this possible using only SQL?
Any thoughts?

ps,
table name is: tblMyID
column name is: RE_ID

Thanks in advance!
Tom
Nov 13 '05 #1
2 21809
Thomas McK wrote:
Hi all,

I'm trying to make a SQL query (against a table in MS Access) where I
want to take the value of something, and check to see if the first two
letters in that value are capitalized (for importing purposes later
on!). For example:

re_200_3 <-- I want this to be returned because the "re" isn't
uppercase.
RE_200_2 <-- This value would be fine because it *is* uppercase.

So, my question, would I be able to treat the value as a String in
this query and return the value that does not have just the first two
letters uppercase? I was thinking about possibly using a TRIM
function to possibly drop everything after the '_', but I'm not sure
that's possible. (If only I was doing this in VB I could create an
array...etc...but c'est la vie). I've done a bit of research and seen
people use functions such as UCASE and CHECK, but for some reason I
doubt this will work in my case. Is this possible using only SQL?
Any thoughts?

ps,
table name is: tblMyID
column name is: RE_ID

Thanks in advance!
Tom


IS your database set to be case senstive? If so then ">='a'"

If not then
Where (ASC(Left(FieldName,1)) between 97 and 122 ) And
ASC(Mid(FieldName,2,1)) between 97 and 122

Will return "re" but not "Re" or "rE", to get them use "or" instead of
"and".
Nov 13 '05 #2

"Thomas McK" <ed********@yahoo.com> wrote in message
news:85**************************@posting.google.c om...
Hi all,

I'm trying to make a SQL query (against a table in MS Access) where I
want to take the value of something, and check to see if the first two
letters in that value are capitalized (for importing purposes later
on!). For example:

re_200_3 <-- I want this to be returned because the "re" isn't
uppercase.
RE_200_2 <-- This value would be fine because it *is* uppercase.

So, my question, would I be able to treat the value as a String in
this query and return the value that does not have just the first two
letters uppercase? I was thinking about possibly using a TRIM
function to possibly drop everything after the '_', but I'm not sure
that's possible. (If only I was doing this in VB I could create an
array...etc...but c'est la vie). I've done a bit of research and seen
people use functions such as UCASE and CHECK, but for some reason I
doubt this will work in my case. Is this possible using only SQL?
Any thoughts?

ps,
table name is: tblMyID
column name is: RE_ID

Thanks in advance!
Tom

Look at the strComp function in the help file. In the example below I have
defined an extra column for a query and where the first 2 characters are in
uppercase, the column returns 0:

MyResult:StrComp(Left([MyField],2),UCase(Left([MyField],2)),0)

Nov 13 '05 #3

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

Similar topics

8
by: MLH | last post by:
I have a textbox on a form into which an alpha-numeric string of data is entered. I wish to force the casual user, who would sometimes use upper case, sometimes not and sometimes MIX the case -...
3
by: Amy | last post by:
Hi, I have 6 If Then Else statements I was supposed to write. I did so but I know that they have to be wrong because they all look the same. Could someone take a look at them and point me in the...
6
by: feeman | last post by:
I can change a field to upper case by using the after event function and the following code Me. = UCase(Me.) But how can you do it so that the whole form will change to Uppercase, there are...
4
by: JohnH | last post by:
I have a simple task to perform that I cannot seem to figure out. I have two tables: OR_CUs OR_CEOs They share (can be joined on) a field called , which is just the name of the CU. All I...
2
by: setabery | last post by:
When entering a value to a field, is there a way to make only the first letter upper case without using the Shift Key? For example, entering a name.
14
by: fniles | last post by:
In VB.NET 2005 can I check if a letter in a string is upper case or lower case ? For example: I have the following 2 lines: NQ,Z2003,11/11/2003,1416.5,1420,1402,1411.5...
5
by: Middletree | last post by:
I want to take a value that users type into a field (actually 2 fields--first and last name) and convert the first letter to Upper Case. I htought I could use UCase, but it seems to only work for...
4
Fary4u
by: Fary4u | last post by:
Baically how i can differentiate Query like i need 1st Query + including 2nd part + including 3rd part & so on & so forth SQL Query i need is like this Residential (Not Commercial) but Tolet...
7
by: MLH | last post by:
If I drop Like "*ABC*" in a QBE grid criteria cell, the records returned include mixed case. Can I force the uppercase limitation in a QBE grid?
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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,...

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.