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)
 How to find Length of a Text

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-04-01 : 08:08:23
marri writes "Dear Sir,
I have a problem
Actually in a stored procedure i am manipulating text data type variable .
I want to Know how to Get Length of a Text
ex
Create Proc TEst(
@txtName Text
)
AS
Begin
Set @txtName='MarriSrikanth'
Select @txtName
--Now I want to get Length of @txtName
End"

robvolk
Most Valuable Yak

15732 Posts

Posted - 2005-04-01 : 08:09:45
You cannot manipulate text or image datatypes. The DATALENGTH() function can give you the length of the variable's contents though.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-04-01 : 08:19:23
Or you can use len() function
Set @txtName='MarriSrikanth'
Select @txtName
Select len(@txtName)

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

Bustaz Kool
Master Smack Fu Yak Hacker

1834 Posts

Posted - 2005-04-01 : 11:21:09
Be aware that LEN() does not count any trailing blanks. It's a common Gotcha to avoid.

HTH

=================================================================
In order to improve the mind, we ought less to learn than to contemplate.
-Rene Descartes, philosopher and mathematician (1596-1650)
Go to Top of Page
   

- Advertisement -