How to findout the length of a string variable in sql server 2000

  • i did this for triming : ltrim(rtrim(strVar)) , and here i have to know

    the length of this string varibale strVar

  • have u tried the len function...

    as in len(ltrim(rtrim(strVar))) .

  • yess !! you won.

  • technically you would only need len(ltrim(someString)), len ignores trailing whitespace.

    ---------------------------------------------------------
    How best to post your question[/url]
    How to post performance problems[/url]
    Tally Table:What it is and how it replaces a loop[/url]

    "stewsterl 80804 (10/16/2009)I guess when you stop and try to understand the solution provided you not only learn, but save yourself some headaches when you need to make any slight changes."

  • ok.Thanks a lot.

  • It depends on the purpose for knowing the length.

    LEN on unicode strings only gets the number of characters and omits trailing spaces.

    DATALENGTH on unicode strings get the number of bytes needed to store the number of characters including trailing spaces.


    N 56°04'39.16"
    E 12°55'05.25"

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply