开发者

find length of the ntext column type data in sql 2000

I have a data in column which is of type NTEXT. I wanted to know the length of the data using query in sql 2000

-----Updates -----

HI, I had us开发者_Python百科ed the datalength thing earlier. But strangely its returning wrong values. Is there any other issue thts specific tht i shlould check.


You want DATALENGTH();

SELECT DATALENGTH(ntextcol) FROM T


You can use DATALENGTH itself.

For datatype ntext storage size in bytes, is two times the number of characters entered

This might have caused you confusion.


You can use DATALENGTH to get the length of a NTEXT


Create table TestTable
(
    Id int identity,NtextCol NTEXT
)
GO
insert into TestTable
Select 'yogesh'
GO
insert into TestTable
Select 'bhadauriya'

Select Datalength(NtextCol)--get lenght of the data
From TestTable

Go
Drop table TestTable


You can also use LEN ( string_expression ), where string_expression can be string expression to be evaluated. string_expression can be a constant, variable, or column of either character or binary data.


ssilas777 mentioned "Storage size in bytes, is two times the number of characters entered"

With this in mind, datalength([nTextColumn]) / 2 as nTextColumn_length should return the specific answer being asked in the original post.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜