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)
 finding a section of text in a ntext field

Author  Topic 

martij2
Starting Member

4 Posts

Posted - 2007-12-06 : 10:29:27
Hi can anyone advise me how i can return a section of text from an ntext field, i can use charindex() on text fields but not on ntext fields - any cleaver ideas out there?

Many thanks.

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-12-06 : 10:35:41
You can return characters from a column with CHARINDEX?

Taken from Books Online
quote:
CHARINDEX cannot be used with text, ntext, and image data types.


Try PATINDEX and SUBSTRING.




E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

NeilG
Aged Yak Warrior

530 Posts

Posted - 2007-12-06 : 10:44:00
You could also use the like operator in the where clause but that is not as reliable as the patindex
Go to Top of Page

martij2
Starting Member

4 Posts

Posted - 2007-12-06 : 10:51:26
top dollar many thanks.
Go to Top of Page
   

- Advertisement -