The LEN should return the same, the datalenght for the N-prefixed value should be twice that for the value without the N. See above difference between datalength on varchar and narchar for the reason. Gail Shaw Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci) ...
SELECT @string AS 'String', DATALENGTH(@string) AS 'Datalength' , LEN(@string) AS 'Len' Note:The LEN() method provides the length of a character excluding trailing blanks stored in the string expression whereas the DATALENGTH() method provides the number of byte spaces occupied by the c...
Can I use LEN or DATALENGTH in a WHERE clause? Can I use OUTER JOIN on 2 columns at the same time? Can row_number() work in UNION STATEMENTS ? Can someone explain just exactly why xp_cmdshell is such a massive risk?! Can SQL Profiler give you the Missing Index information? Can Symm...
@firstName FirstName,DATALENGTH(@firstName)Length Result: FirstName Length B 1If Optional parameter valuenis not specified in the variable declaration or column definition then it is considered as 1. Example: DECLARE@firstNameNVARCHAR=‘BASAVARAJ’ SELECT @firstName FirstName,DATALENGTH(@firstName)Le...
Can I use LEN or DATALENGTH in a WHERE clause? Can I use OUTER JOIN on 2 columns at the same time? Can row_number() work in UNION STATEMENTS ? Can someone explain just exactly why xp_cmdshell is such a massive risk?! Can SQL Profiler give you the Missing Index information? Can Sy...
Can I use LEN or DATALENGTH in a WHERE clause? Can I use OUTER JOIN on 2 columns at the same time? Can row_number() work in UNION STATEMENTS ? Can someone explain just exactly why xp_cmdshell is such a massive risk?! Can SQL Profiler give you the Missi...
Can I use LEN or DATALENGTH in a WHERE clause? Can I use OUTER JOIN on 2 columns at the same time? Can row_number() work in UNION STATEMENTS ? Can someone explain just exactly why xp_cmdshell is such a massive risk?! Can SQL Profiler give you the Missing Index information? Can Symm...
Can I use LEN or DATALENGTH in a WHERE clause? Can I use OUTER JOIN on 2 columns at the same time? Can row_number() work in UNION STATEMENTS ? Can someone explain just exactly why xp_cmdshell is such a massive risk?! Can SQL Profiler give you the Missing Index information? Can Sy...
Can I use LEN or DATALENGTH in a WHERE clause? Can I use OUTER JOIN on 2 columns at the same time? Can row_number() work in UNION STATEMENTS ? Can someone explain just exactly why xp_cmdshell is such a massive risk?! Can SQL Profiler give you the Missing Index information? Can Symm...
Can I use LEN or DATALENGTH in a WHERE clause? Can I use OUTER JOIN on 2 columns at the same time? Can row_number() work in UNION STATEMENTS ? Can someone explain just exactly why xp_cmdshell is such a massive risk?! Can SQL Profiler give you the Missing Index information? Can Symm...