SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 How to manipulate with ntext data?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

cogitovn
Starting Member

1 Posts

Posted - 04/18/2008 :  12:05:29  Show Profile  Reply with Quote
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

India
52317 Posts

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

chandan_joshi80
Starting Member

India
30 Posts

Posted - 04/19/2008 :  07:34:13  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

USA
6062 Posts

Posted - 04/19/2008 :  08:40:28  Show Profile  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000