Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2002
    Posts
    4

    Red face Unanswered: sqlserver2k ntext length ?

    Hi,
    Does anybody how to calculate the length of a ntext field in order to use the READTEXT command ?

    I'm trying to build an sp or function similar to REPLACE but to be used with a NTEXT parameter.

    Thanks

  2. #2
    Join Date
    Feb 2002
    Posts
    2,232
    Are you concerned about the size parameter of readtext - why not just use the maximum value allowed for ntext ?

  3. #3
    Join Date
    Dec 2002
    Posts
    4
    If you try to use a value, for the "size" parameter, wich is bigger than the real length of the ntext field you will receive an error.

    I think I found the answer for my question. In order to know how many chars a ntext value have, one have to use the DATALENGTH function.
    And, because we're talking of an unicode value (2 bytes for each char), one have to divide per 2 that result.

  4. #4
    Join Date
    Feb 2002
    Posts
    2,232
    That is strange because sqloledb does just that - uses the maximum.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •