Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Collation Issue i suspect ?

Author  Topic 

KnooKie
Aged Yak Warrior

623 Posts

Posted - 2005-02-23 : 05:48:02
VB6 & SQL 7

i have a search screen that searches for people using firstname and lastname (2 seperate textboxes that are fed into stored procedure below).

The problem is this does not work if such characters as é exist in the persons name.

for example.......
they want to be able to type in 'andre'
and get back everybody whose firstname is 'andre' AND andré

First thought was to use the replace function (example added in SP below) but there are too many combinations to make it viable and the stored procedure would take ages to run i suspect.

i've read a few posts on collation here and that seems to be the direction i need to go but how can i cater for all 'funny' characters ? We have people from all over the world in the database so any 'funny' character could appear. e.g. with diaresis, acute, grave, cedilla, stroke and the funny Beta character the germans use to name a few that spring to mind.

Is there a collation that can handkle them all ?

Help in any direction appreciated ?


alter PROCEDURE usp_Search_BrokerEmployee_sel
@Forename varchar(50),
@Surname varchar(50)
AS
-- ** Used within frm_SearchBrokerEmployee **
SELECT Broker_Employee.fs_forename,
Broker_Employee.fs_surname,
Brokers_in_UID.fs_brokerNameinUID,
Broker_Employees_in_UID.fs_UID,
Broker_Employee_Positions.fs_positionDescription,
Broker_Employees_in_UID.f_brokerEmployeeCode,
Broker_Employees_in_UID.fl_brokerCode,
Broker_Employees_in_UID.fb_Validated
FROM
Brokers_in_UID
INNER JOIN
Broker_Employees_in_UID
ON
Brokers_in_UID.fl_brokerCode = Broker_Employees_in_UID.fl_brokerCode
AND
Brokers_in_UID.fs_UID = Broker_Employees_in_UID.fs_UID
INNER JOIN
Broker_Employee
ON
Broker_Employees_in_UID.f_brokerEmployeeCode = Broker_Employee.fa_brokerEmployeeCode
INNER JOIN
Broker_Employee_Positions
ON
Broker_Employees_in_UID.fl_position = Broker_Employee_Positions.fa_positionCode
WHERE
Broker_Employee.fs_Forename like (@Forename + '%')
AND
Broker_Employee.fs_Surname like (replace(@Surname,'e','[e,é]') + '%')
ORDER BY
Broker_Employee.fs_surname,
Brokers_in_UID.fs_brokerNameinUID,
Broker_Employees_in_UID.fs_UID



====
Paul

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-02-23 : 06:06:53
try SQL_Latin1_General_CP850_CI_AI

EDIT: an example

declare @b table (name varchar(50) collate SQL_Latin1_General_CP850_CI_AI)
insert into @b
select 'äöë' union all
select 'aoe'

select * from @b
where name like '%aoe%'


Go with the flow & have fun! Else fight the flow
Go to Top of Page

KnooKie
Aged Yak Warrior

623 Posts

Posted - 2005-02-23 : 06:45:10
thanks for reply

can i specify this collation for the appropriate columns in my stored procedure ?

i am reading that SQL7 has limitations with regards to collation at column level.


====
Paul
Go to Top of Page

KnooKie
Aged Yak Warrior

623 Posts

Posted - 2005-02-23 : 06:57:37
hmmm i saw this post from the nearly SQL warrior queen which suggests i may be a bit stuffed unless it is safe for me to change the collation at the server level which i am unsure about ?

We have SQL Server 7....sadly

Any ideas ? Anyone

quote:

What version of SQL Server are you using? Only SQL Server 2000 allows collations to be set at the server, database or column level. Before SQL Server 2000, you could only specify the collation on the server level.

Tara




====
Paul
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-02-23 : 07:18:09
why couldn't you change it?

Go with the flow & have fun! Else fight the flow
Go to Top of Page

KnooKie
Aged Yak Warrior

623 Posts

Posted - 2005-02-23 : 07:29:22
i've not tried changing it yet. i'll try it on our test system and see what happens.


====
Paul
Go to Top of Page

KnooKie
Aged Yak Warrior

623 Posts

Posted - 2005-02-23 : 07:31:05
looks like it's a bit more involved than i'd hoped.

http://www.sqlteam.com/Forums/topic.asp?TOPIC_ID=20695&SearchTerms=collation


====
Paul
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-02-23 : 07:38:45
yeah.... upgrade to sql server 2000...

Go with the flow & have fun! Else fight the flow
Go to Top of Page
   

- Advertisement -