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)
 text field line count

Author  Topic 

Anamika
Starting Member

3 Posts

Posted - 2007-09-21 : 09:23:03
I want to find the no. of lines in my text field inclusive of trailing spaces and new lines.
ex:
MARY HAD A LITTLE LAMB
FLEECE WAS WHITE AS SNOW
should return me 2

I tried DATALENGTH()

Any suggestions?


Anamika
http://technoblab.blogspot.com

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-09-21 : 09:30:35
Count number of CR characters in your text field using charindex(). You can write a UDF for this.

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

PeterNeo
Constraint Violating Yak Guru

357 Posts

Posted - 2007-09-21 : 09:40:48
Hi,

try this
SELECT CHARINDEX(CHAR(10), urfield) FROM urtable

Look for CHAR() in BOL
Go to Top of Page
   

- Advertisement -