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
 Transact-SQL (2000)
 How to manipulate with ntext data?

Author  Topic 

cogitovn
Starting Member

1 Post

Posted - 2008-04-18 : 12:05:29
I design a table with a column in ntext data. I want to search on this field without differentiate between low case and super case.
For example:

select Lower(Content) from Book

Error is: "Argument data type ntext is invalid for argument 1 of lower function."

How can I convert case with ntext?

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-04-18 : 13:57:59
Have a look at UPDATETEXT() & TEXTPTR() functions.
Go to Top of Page

chandan_joshi80
Starting Member

30 Posts

Posted - 2008-04-19 : 07:34:13
declare @t table (RequestId int, Dept int, ADate NTEXT)
insert @t
select 1001, 1, 'AMIT'
union all select 1001, 2, 'SUMTI'
union all select 1001, 1, 'NEHA'

SELECT LOWER(CAST (ADATE AS VARCHAR(10))) FROM @t

LOWER CASE TAKES EXPRESSION THAT implicitly convertible to varchar,SO YOU NEED TO CAST EXPLICITLY

chandan Joshi
Go to Top of Page

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2008-04-19 : 08:40:28
Your nText column will may have values that excede your varchar limit.

Depends on your collation as to whether or not string comparisons are case sensitive. You can always override the default collation in the query itself:

use northwind

--case insensitive
select notes from employees where notes like '%English%' COLLATE Latin1_General_CI_AS

--case sensitive
select notes from employees where notes like '%english%' COLLATE Latin1_General_CS_AS


Be One with the Optimizer
TG
Go to Top of Page
   

- Advertisement -