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)
 Len Query

Author  Topic 

starnold
Yak Posting Veteran

83 Posts

Posted - 2005-08-01 : 07:36:22
I need to update a field where another field is longer than 6 characters?

I haven't used len before and am trying to use it in a where clause?

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-08-01 : 07:47:09
Is this?

Update table set col=othercol where len(othercol)>6

If not, post some sample data with expected result

Madhivanan

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

Bustaz Kool
Master Smack Fu Yak Hacker

1834 Posts

Posted - 2005-08-01 : 11:28:06
Be aware that the LEN function does not count any trailing blanks in the string/column. This can be a gotcha.

DataLength can be an option around this but it returns the number of bytes; not characters. For non-Unicode this is equivalent but Unicode uses two bytes per character.

HTH

=================================================================
The most tyrannical of governments are those which make crimes of opinions, for everyone has an inalienable right to his thoughts. -Baruch Spinoza, philosopher (1632-1677)
Go to Top of Page
   

- Advertisement -