A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Case sensitivity & Primary key



 
 
Thread Tools Display Modes
  #1  
Old May 8th, 2007, 12:41 PM posted to microsoft.public.access.tablesdbdesign
Peter
external usenet poster
 
Posts: 962
Default Case sensitivity & Primary key

I am using Access 2003. I am not pulling data from any other database.
I have a table with a field that contains records such as 8H7N and 8H7n -
that is they only differ by the case of the letters, "n" in this example.
Unfortunately I have no control over this so I have to try and make it work
with this case sensitivity. To make matters worse I need this field to be a
primary key. I cannot do this at the moment because records like this are
not considered unique.
There are no other fields in this or any other table in the database where
case is an issue.

Is there anyway I can do what I want? I have read about the ability to turn
case sensitivity on & off at the field level but I don't think that that was
in Access.

Many thanks in advance for any help, advice or pointer you can give me.

Peter
  #2  
Old May 8th, 2007, 12:57 PM posted to microsoft.public.access.tablesdbdesign
Rick Brandt
external usenet poster
 
Posts: 4,354
Default Case sensitivity & Primary key

"Peter" wrote in message
...
I am using Access 2003. I am not pulling data from any other database.
I have a table with a field that contains records such as 8H7N and 8H7n -
that is they only differ by the case of the letters, "n" in this example.
Unfortunately I have no control over this so I have to try and make it work
with this case sensitivity. To make matters worse I need this field to be a
primary key. I cannot do this at the moment because records like this are
not considered unique.
There are no other fields in this or any other table in the database where
case is an issue.

Is there anyway I can do what I want? I have read about the ability to turn
case sensitivity on & off at the field level but I don't think that that was
in Access.

Many thanks in advance for any help, advice or pointer you can give me.


There are ways to do case sensitive comparisons in Access, but you cannot make
the data at the table level case-sensitive. Certainly not to the degree that
you could make that your Primary Key.

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com


  #3  
Old May 8th, 2007, 01:28 PM posted to microsoft.public.access.tablesdbdesign
Stefan Hoffmann
external usenet poster
 
Posts: 709
Default Case sensitivity & Primary key

hi Peter,

Peter wrote:
I have a table with a field that contains records such as 8H7N and 8H7n -
that is they only differ by the case of the letters, "n" in this example.
Unfortunately I have no control over this so I have to try and make it work
with this case sensitivity. To make matters worse I need this field to be a
primary key.

You don't need it to be the primary key, use a surrogat key, e.g. an
autoincrement as primary key.

To keep it unique in the database, you must use a different encoding,
e.g. Hex(). Untested code:

Public Function GetHex(AString As String) As String

GetHex = ""
For Count = 1 To Len(AString)
GetHex = GetHex & Right("00" & Hex$(Mid$(AString, Count, 1)), 2)
Next Count

End Function

Public Function GetStr(AHex As String) As String

GetStr = ""
For Count = 0 To Len(AHex) \ 2
GetStr = GetStr & Chr$(Val("&H" & Mid$(AHex, Count * 2 + 1, 2))
Next Count

End Function


mfG
-- stefan --
  #4  
Old May 8th, 2007, 02:38 PM posted to microsoft.public.access.tablesdbdesign
Peter
external usenet poster
 
Posts: 962
Default Case sensitivity & Primary key

Thank you both for such quick replies. I will try your suggestion Stefan.

Thanks again, Peter

"Stefan Hoffmann" wrote:

hi Peter,

Peter wrote:
I have a table with a field that contains records such as 8H7N and 8H7n -
that is they only differ by the case of the letters, "n" in this example.
Unfortunately I have no control over this so I have to try and make it work
with this case sensitivity. To make matters worse I need this field to be a
primary key.

You don't need it to be the primary key, use a surrogat key, e.g. an
autoincrement as primary key.

To keep it unique in the database, you must use a different encoding,
e.g. Hex(). Untested code:

Public Function GetHex(AString As String) As String

GetHex = ""
For Count = 1 To Len(AString)
GetHex = GetHex & Right("00" & Hex$(Mid$(AString, Count, 1)), 2)
Next Count

End Function

Public Function GetStr(AHex As String) As String

GetStr = ""
For Count = 0 To Len(AHex) \ 2
GetStr = GetStr & Chr$(Val("&H" & Mid$(AHex, Count * 2 + 1, 2))
Next Count

End Function


mfG
-- stefan --

  #5  
Old May 10th, 2007, 04:59 PM posted to microsoft.public.access.tablesdbdesign
Jerry Whittle
external usenet poster
 
Posts: 4,732
Default Case sensitivity & Primary key

If you have the time and budget, Oracle is case sensitive including primary
key constraints..
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.

"Peter" wrote:

Thank you both for such quick replies. I will try your suggestion Stefan.

Thanks again, Peter

"Stefan Hoffmann" wrote:

hi Peter,

Peter wrote:
I have a table with a field that contains records such as 8H7N and 8H7n -
that is they only differ by the case of the letters, "n" in this example.
Unfortunately I have no control over this so I have to try and make it work
with this case sensitivity. To make matters worse I need this field to be a
primary key.

You don't need it to be the primary key, use a surrogat key, e.g. an
autoincrement as primary key.

To keep it unique in the database, you must use a different encoding,
e.g. Hex(). Untested code:

Public Function GetHex(AString As String) As String

GetHex = ""
For Count = 1 To Len(AString)
GetHex = GetHex & Right("00" & Hex$(Mid$(AString, Count, 1)), 2)
Next Count

End Function

Public Function GetStr(AHex As String) As String

GetStr = ""
For Count = 0 To Len(AHex) \ 2
GetStr = GetStr & Chr$(Val("&H" & Mid$(AHex, Count * 2 + 1, 2))
Next Count

End Function


mfG
-- stefan --

  #6  
Old October 7th, 2008, 12:52 PM posted to microsoft.public.access.tablesdbdesign
Leon
external usenet poster
 
Posts: 65
Default Case sensitivity & Primary key

silly, question:
where do i type the code?
is it modules?

"Jerry Whittle" wrote:

If you have the time and budget, Oracle is case sensitive including primary
key constraints..
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.

"Peter" wrote:

Thank you both for such quick replies. I will try your suggestion Stefan.

Thanks again, Peter

"Stefan Hoffmann" wrote:

hi Peter,

Peter wrote:
I have a table with a field that contains records such as 8H7N and 8H7n -
that is they only differ by the case of the letters, "n" in this example.
Unfortunately I have no control over this so I have to try and make it work
with this case sensitivity. To make matters worse I need this field to be a
primary key.
You don't need it to be the primary key, use a surrogat key, e.g. an
autoincrement as primary key.

To keep it unique in the database, you must use a different encoding,
e.g. Hex(). Untested code:

Public Function GetHex(AString As String) As String

GetHex = ""
For Count = 1 To Len(AString)
GetHex = GetHex & Right("00" & Hex$(Mid$(AString, Count, 1)), 2)
Next Count

End Function

Public Function GetStr(AHex As String) As String

GetStr = ""
For Count = 0 To Len(AHex) \ 2
GetStr = GetStr & Chr$(Val("&H" & Mid$(AHex, Count * 2 + 1, 2))
Next Count

End Function


mfG
-- stefan --

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 06:50 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.