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.
| 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 )ASBeginSet @txtName='MarriSrikanth'Select @txtName--Now I want to get Length of @txtNameEnd" |
|
|
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. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-04-01 : 08:19:23
|
| Or you can use len() functionSet @txtName='MarriSrikanth'Select @txtNameSelect len(@txtName)MadhivananFailing to plan is Planning to fail |
 |
|
|
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) |
 |
|
|
|
|
|