473,804 Members | 2,136 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Case Insensitivity

I have a SQL 2000 database. I have a ASP.NET web app that I use to
search this database. I need to make my data case insensitive,
espcially my last name column. How do I change this?

Thanks,
Brian

Jul 23 '05 #1
5 1291
I was doing some further reading and I am hearing that you set case
sensitivity when you first install SQL by choosing an ANSI set and the
only way to change this is to re-install SQL. Is this correct? There
has to be another way around this....

Jul 23 '05 #2
See "Specifying Collations" and "Collation Precedence" in Books
Online. You can change the collation at the database or column level
(see ALTER DATABASE and ALTER TABLE), or in your queries (see COLLATE).
Personally, I would modify the queries (or perhaps create a view)
rather than have one or two columns in a database in a different
collation from the rest.

Simon

Jul 23 '05 #3
There is another way in SQL2000. Collation is determined at column
level so you can alter the case-sensitivity and other collation
properties at any time. For example:

ALTER TABLE YourTable
ALTER COLUMN last_name VARCHAR(50)
COLLATE Latin1_General_ CI_AS

Read the Collations topics in Books Online to understand the collation
syntax and how this affects comparisons between columns of different
collation.

--
David Portas
SQL Server MVP
--

Jul 23 '05 #4
I used your syntax and everything works like a charm except for one
thing, now when I do a search, such as "W" in the lastname field, it
pulls every records that contains a "W" in the last name, rather than
names that start with "W". How do you correct this? it needs to search
from left to right.

Thanks,
Brian

Jul 23 '05 #5
Stu
What's the SQL statement you are using to SELECT? It sounds like
you're putting a wildcard in front of and behind the character you are
searching on, e.g.:

SELECT ColName
FROM Table
WHERE ColName LIKE '%W%'

when it sounds like you want the wildcard after

SELECT ColName
FROM Table
WHERE ColName LIKE 'W%'

Your collation settings should only affect the case sensity of the
database; not how your LIKE comparisons perform. Am I
misunderstandin g?

Stu

Jul 23 '05 #6

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

Similar topics

32
3173
by: Elliot Temple | last post by:
Hi I have two questions. Could someone explain to me why Python is case sensitive? I find that annoying. Also, why aren't there multiline comments? Would adding them cause a problem of some sort? Thanks, Elliot
1
2934
by: D. Alvarado | last post by:
Hello, I'm sure this is a pretty easy question, but how would I indnicate in my XML schema that I wanted to make attribute name comparisons case insensitive? For example, is I had an element <MYELEMENT myattr="1"> I would want the "myattr" attribute to validate against <xs:schema name="MYATTR" type="xs:integer"/>
2
10317
by: Tom | last post by:
Hi, Our development team is adding DB2 8.1 compatibility to our existing application which currently supports SQLServer 2000. Our code is written to take advantage of SQLServer's ability to allow query string compares to be case insensitive. We have identified DB2 forces all query string compares to be evaluated case sensitive. Since our code is written to assume case insensitivity, it curently seems that we must change our code...
7
1715
by: Jan Nielsen | last post by:
Hi all I am learning Asp.Net using Vb.net (VS 2002). I found the following example in a book: Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim count As Integer If Not Me.ViewState("Count") Is Nothing Then
6
1666
by: crosser | last post by:
I have class written in C# with elements: 1. Private variable: aaa 2. Protected overridable property AAA the only differrence in names is case sensitivity. Is it possible to shadow variable aaa in inherited class using Visual Basic ? I can't find a solution because of Visual Basic case insensitivity...
3
4840
by: UMPA Development | last post by:
Hello all! Is it possible to setup a group by to be case insensitive and if so how? Thank you! ---------------------------(end of broadcast)--------------------------- TIP 8: explain analyze is your friend
13
4724
by: Tom Anderson | last post by:
Afternoon all, MacOS X seems to have some heretical ideas about the value of case in paths - it seems to believe that it doesn't exist, more or less, so "touch foo FOO" touches just one file, you can't have both 'makefile' and 'Makefile' in the same directory, "os.path.exists(some_valid_path.upper())" returns True even when "os.path.split(some_valid_path.upper()) in os.listdir(os.path.split(some_valid_path))" returns False, etc...
15
1569
by: gregory_may | last post by:
Is there any options in VS 2005 to better handle case issues in C# (Similar to VB.Net)?
38
13220
by: Bart | last post by:
Why is C case sensitive? I know it's a bit late to change it now but there would seem to be far more advantages in ignoring letter case in source code. In real life such a situation would be ridiculous (eg. the 16 ways of writing my name) and, in some cases, frightening. Is it to avoid having to think up new identifiers? And how would you distinguish case when reading out bits of code over the phone for
7
2978
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 example, user1 is equal to User1. This causes some problems in cases where I validate user names for authentication to access some secure files. Anyway, what can I do to make sure User1 cannot log in if database stores user1? Suggestions are very...
0
9711
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10595
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10335
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10088
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9169
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7633
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5529
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5668
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4306
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.