Hi
I am trying to do the following.
I have a set of records
Example
1 Test
2 test
3 TEST
4 ACCESS
5 EXCEL
If I'm running a query with a count I am getting the following result
record number of records
test 3
access 1
excel 1
My question is how can I make the query casesensetive so that my
query output
will be
record number of records
Test 1
test 1
TEST 1
Access 1
Excel 1
This means that the query shouldn't count test as one record but as 3
seperate records because there is a difference in the upper and lower
cases.
Thanks in advance
Ajay 6 2376 aj*******@yahoo.com (Ajay) wrote in
news:49*************************@posting.google.co m: Hi I am trying to do the following. I have a set of records Example 1 Test 2 test 3 TEST 4 ACCESS 5 EXCEL
If I'm running a query with a count I am getting the following result record number of records test 3 access 1 excel 1
My question is how can I make the query casesensetive so that my query output will be record number of records Test 1 test 1 TEST 1 Access 1 Excel 1
This means that the query shouldn't count test as one record but as 3 seperate records because there is a difference in the upper and lower cases.
You might TRY (after backing up your table) changing the field type to
Binary.
--
Lyle
(for e-mail refer to http://ffdba.com/contacts.htm)
Lyle Fairfield <Mi************@Invalid.Com> wrote in
news:Xn*******************@130.133.1.4: aj*******@yahoo.com (Ajay) wrote in news:49*************************@posting.google.co m:
Hi I am trying to do the following. I have a set of records Example 1 Test 2 test 3 TEST 4 ACCESS 5 EXCEL
If I'm running a query with a count I am getting the following result record number of records test 3 access 1 excel 1
My question is how can I make the query casesensetive so that my query output will be record number of records Test 1 test 1 TEST 1 Access 1 Excel 1
This means that the query shouldn't count test as one record but as 3 seperate records because there is a difference in the upper and lower cases.
You might TRY (after backing up your table) changing the field type to Binary.
If you are using XP you could use:
CurrentProject.Connection.Execute "ALTER TABLE tbl2002Transactions ALTER
fldDescription Binary"
I think this will work for 2K as well.
--
Lyle
(for e-mail refer to http://ffdba.com/contacts.htm)
"Ajay" <aj*******@yahoo.com> wrote in message
news:49*************************@posting.google.co m... Hi I am trying to do the following. I have a set of records Example 1 Test 2 test 3 TEST 4 ACCESS 5 EXCEL
If I'm running a query with a count I am getting the following result record number of records test 3 access 1 excel 1
My question is how can I make the query casesensetive so that my query output will be record number of records Test 1 test 1 TEST 1 Access 1 Excel 1
This means that the query shouldn't count test as one record but as 3 seperate records because there is a difference in the upper and lower cases.
Thanks in advance
Ajay
As an alternative to Lyle's which does not involve changing data types you
could simply write a query. Asuming the data 'Test', 'test', 'TEST' etc is
held in a field called MyField in the table MyTable, then the query would
be:
SELECT MyField, Count(*) AS MyTotal
FROM MyTable
GROUP BY MyField, GetAscString([MyField])
You would simply have to paste the following function into a code module:
' ************************************************** ***
Public Function GetAscString(varInput) As String
Dim lngCount As Long
Dim strOut As String
If Len(varInput) > 0 Then
For lngCount = 1 To Len(varInput)
strOut = strOut & Asc(Mid$(varInput, lngCount, 1))
Next lngCount
End If
GetAscString = strOut
End Function
' ************************************************** ***
HTH
Fletcher
"Fletcher Arnold" <fl****@home.com> wrote in message
news:bn**********@sparta.btinternet.com...
(snip) As an alternative to Lyle's which does not involve changing data types you could simply write a query. Asuming the data 'Test', 'test', 'TEST' etc
is held in a field called MyField in the table MyTable, then the query would be:
SELECT MyField, Count(*) AS MyTotal FROM MyTable GROUP BY MyField, GetAscString([MyField])
You would simply have to paste the following function into a code module:
' ************************************************** *** Public Function GetAscString(varInput) As String
Dim lngCount As Long Dim strOut As String
If Len(varInput) > 0 Then For lngCount = 1 To Len(varInput) strOut = strOut & Asc(Mid$(varInput, lngCount, 1)) Next lngCount End If
GetAscString = strOut
End Function
' ************************************************** ***
You would want to pad the Asc values to a fixed length, eg:
format(asc(...), "000").
Otherwise, you don't know whether "12345" was 1, 23, 45 or: 123, 45 or: 1,
234, 5 etc. - so in principle, you could erroneously match those three
strings, as just one string.
I realize this might not happen with the actual numbers in question. But as
a matter of principle, it would be safer to do the fixed-length thing.
TC
"TC" <a@b.c.d> wrote in message news:1066802481.214681@teuthos... "Fletcher Arnold" <fl****@home.com> wrote in message news:bn**********@sparta.btinternet.com...
(snip)
As an alternative to Lyle's which does not involve changing data types
you could simply write a query. Asuming the data 'Test', 'test', 'TEST' etc is held in a field called MyField in the table MyTable, then the query
would be:
SELECT MyField, Count(*) AS MyTotal FROM MyTable GROUP BY MyField, GetAscString([MyField])
You would simply have to paste the following function into a code
module: ' ************************************************** *** Public Function GetAscString(varInput) As String
Dim lngCount As Long Dim strOut As String
If Len(varInput) > 0 Then For lngCount = 1 To Len(varInput) strOut = strOut & Asc(Mid$(varInput, lngCount, 1)) Next lngCount End If
GetAscString = strOut
End Function
' ************************************************** ***
You would want to pad the Asc values to a fixed length, eg: format(asc(...), "000").
Otherwise, you don't know whether "12345" was 1, 23, 45 or: 123, 45 or: 1, 234, 5 etc. - so in principle, you could erroneously match those three strings, as just one string.
I realize this might not happen with the actual numbers in question. But
as a matter of principle, it would be safer to do the fixed-length thing.
TC
Hi TC
This did cross my mind, however if you look at the select query, you will
see that I group first by MyField then by GetAscString([MyField]). This
means that the first 'group by' looks at the string - it doesn't need to
'understand' the code to correctly group 'test', 'Test' and 'TEST' together,
and 'one', two', 'three' apart. In other words, with the word 'test' for
example, 116,101,115,116 is already correctly grouped as the word 'test' -
it couldn't be grouped as 11,61,01,115,116.
It is only when (ignoring upper/lower case) the word is the same, that the
second 'group by' is needed and even then, the code generated is not in the
select clause so the user doesn't see it.
Therefore, I can't see a case (even theoretical) where this query would not
correctly group a list of words. However, experience has taught me to
anticipate being corrected.
Regards
Fletcher
"Fletcher Arnold" <fl****@home.com> wrote in message
news:bn**********@sparta.btinternet.com... "TC" <a@b.c.d> wrote in message news:1066802481.214681@teuthos... "Fletcher Arnold" <fl****@home.com> wrote in message news:bn**********@sparta.btinternet.com...
(snip)
As an alternative to Lyle's which does not involve changing data types you could simply write a query. Asuming the data 'Test', 'test', 'TEST'
etc is held in a field called MyField in the table MyTable, then the query would be:
SELECT MyField, Count(*) AS MyTotal FROM MyTable GROUP BY MyField, GetAscString([MyField])
You would simply have to paste the following function into a code module: ' ************************************************** *** Public Function GetAscString(varInput) As String
Dim lngCount As Long Dim strOut As String
If Len(varInput) > 0 Then For lngCount = 1 To Len(varInput) strOut = strOut & Asc(Mid$(varInput, lngCount, 1)) Next lngCount End If
GetAscString = strOut
End Function
' ************************************************** ***
You would want to pad the Asc values to a fixed length, eg: format(asc(...), "000").
Otherwise, you don't know whether "12345" was 1, 23, 45 or: 123, 45 or:
1, 234, 5 etc. - so in principle, you could erroneously match those three strings, as just one string.
I realize this might not happen with the actual numbers in question. But
as a matter of principle, it would be safer to do the fixed-length thing.
TC
Hi TC This did cross my mind, however if you look at the select query, you will see that I group first by MyField then by GetAscString([MyField]). This means that the first 'group by' looks at the string - it doesn't need to 'understand' the code to correctly group 'test', 'Test' and 'TEST'
together, and 'one', two', 'three' apart. In other words, with the word 'test' for example, 116,101,115,116 is already correctly grouped as the word 'test' - it couldn't be grouped as 11,61,01,115,116. It is only when (ignoring upper/lower case) the word is the same, that the second 'group by' is needed and even then, the code generated is not in
the select clause so the user doesn't see it. Therefore, I can't see a case (even theoretical) where this query would
not correctly group a list of words. However, experience has taught me to anticipate being corrected. Regards
Fletcher
Ah, you are exactly right!
Cheers,
TC This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: C# newbie |
last post by:
Hi,
How can I make my query to return both "Bob" & "bob" (during search for a
string) ?
any idea?
thanks
|
by: vulcaned |
last post by:
Hi All,
In access97 I have a query who's record source is a linked sql table
and when I enter a value the Part nbr filed to select by (ex: A10295X )
I get back only records that have a case match....
|
by: Jeff S |
last post by:
I'm getting started with C# and was just wondering if C# veterans LIKE the
fact that the language is case sensitive. If so, how is case sensitivity
helpful? Do you create multiple variables,...
|
by: Thomas Scheiderich |
last post by:
I thought I read that the case for the variable names is important.
For example
Dim Wheel As Integer
Wheel here is a different variable from WHEEL.
Is this correct?
|
by: Agnes |
last post by:
myGrid.mappingname = "Invoice" -> it doesn't work
myGrid.mappingname = "invoice" -> it seems work .
Case sensetive ?
|
by: Agnes |
last post by:
I found that store procedure with vb.net (seems ignore case senstive)
I type "lax" as code, and it returns the correct answer , How come ??
I can't set the upper case in that textbox, BUT I need...
|
by: A Bruce |
last post by:
hello,
I am attempting to convert a oracle database to postgresql and I am having
some problems creating a constraint across multiple columns which are a
mixture of case insensitive and case...
|
by: ambika_se |
last post by:
Hi all
I want to make a Xquery which is like this
for $x in doc("file:///C:/Science.xml")//tva2:title
where $x//node()
return $x
Its working perfectly but if i try for( biological science) its...
|
by: vunet.us |
last post by:
So, I came across the problem every developer comes across with once:
case in SQL. My users login with their selected user name and when SQL
checks for user name value, case is ignored. For...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
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...
|
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,...
|
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...
|
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...
|
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...
| |