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 |
|
s2002
Starting Member
49 Posts |
Posted - 2009-04-05 : 06:44:47
|
| hi,Table designID PKNote Ntext I want to show all records of above table where ntext field length < 200. I have tried len(note) < 200 but I encounter error.How could I find ntext field lenghtsincerelymsam |
|
|
ayamas
Aged Yak Warrior
552 Posts |
Posted - 2009-04-05 : 08:47:43
|
| What is the error?convert to varchar & try. |
 |
|
|
s2002
Starting Member
49 Posts |
Posted - 2009-04-05 : 13:58:53
|
| hiI use this select * from Postwhere LEN(note)< 200I encounter thisMsg 8116, Level 16, State 1, Line 1Argument data type ntext is invalid for argument 1 of len function.sincerely,sam |
 |
|
|
ayamas
Aged Yak Warrior
552 Posts |
Posted - 2009-04-05 : 14:06:29
|
| select * from Postwhere len(convert(varchar(200),note))<200 |
 |
|
|
graz
Chief SQLTeam Crack Dealer
4149 Posts |
Posted - 2009-04-05 : 14:26:58
|
| I'd consider using the DATALENGTH function. Since you're using NTEXT you'll need to divide the result by two.If you switch from NTEXT to NVARCHAR(MAX) you can use the LEN function.=================================================Creating tomorrow's legacy systems today. One crisis at a time. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-04-06 : 05:49:00
|
Also note the point specified in SQL Server help filequote: ntext, text, and image data types will be removed in a future version of Microsoft SQL Server. Avoid using these data types in new development work, and plan to modify applications that currently use them. Use nvarchar(max), varchar(max), and varbinary(max) instead. For more information, see Using Large-Value Data Types.
MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|