Find ntext column type data length in sql 2000

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

----- Updates -----

HI, I used to use datalength. But strange is his return of the wrong values. Is there any other problem I have to check.

+6
source share
6 answers

Do you want DATALENGTH() ;

 SELECT DATALENGTH(ntextcol) FROM T 
+9
source

You can use DATALENGTH .

For the datatype ntext type, the ntext size in bytes is two times larger than the entered characters

This can be confusing.

+3
source

You can use DATALENGTH to get NTEXT length

+2
source
  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
+1
source

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

0
source

ssilas777 mentions "Storage size in bytes, two times the entered characters"

Given this, datalength([nTextColumn]) / 2 as nTextColumn_length should return the specific response specified in the original message.

0
source

Source: https://habr.com/ru/post/892119/


All Articles