would someone please explain why select len(0x0a000b) returns 3? does len count bytes? and why select left(0x0a000b, 1) returns nothing? i expected 0x0a (if len counts bytes)…
i am using mssql 2005
thanks
konstantin
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
select len(0x0a000b)is returning the length of a string represented by the three bytes 0x0a, 0x00, and 0x0b.select left(0x0a000b, 1)returns the left-most character of the string, which is a newline character.Note that
select case when left(0x0a000b, 1) = 0x0a then 1 else 0 endreturns1, which indicates you are, indeed, getting the newline character.Edit: Please see the comments below for additional details.