Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RIGHT command on NTEXT. Not work????? 1

Status
Not open for further replies.

bla1979

MIS
Jun 1, 2006
9
US
I have a NTEXT field, I want to only show the first 100 characters from it, not sure how.

I tried this but got the following error.

Select RIGHT(com_text,100) from blog_comment

ERROR: Argument data type ntext is invalid for argument 1 of right function.
 
>>the first 100 characters
assuming this is English/Latin alphabet you would use LEFT, however you can't use that on text columns
use substring instead

Select SUBSTRING(com_text,1,100) from blog_comment

here is an example
create table #test(wasa text)
insert #test
select 'sfsfsfffffffffffffffffff'

select left(wasa,5) from #test --fails
select substring(wasa,1,5) from #test --success

Denis The SQL Menace
SQL blog:
Personal Blog:
 
If you really want the Left characters, then you could....

Code:
Select Convert(VarChar(100), com_text)
From   Blog_Comment

If you really want the data on the right, lookup textptr in books on line.

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top