|  | Posted by Erland Sommarskog on 06/12/07 21:31 
undercups (dwang@woodace.co.uk) writes:> Use the length function
 >
 > SELECT LENGTH(description) FROM tablename WHERE id = 1
 >
 > This will return the length of the description field for the row
 > identified by id = 1.
 
 There is no LENGTH function in SQL Server.
 
 You may be thinking of len(), but since Visu asked for the space
 consumption, it does not fit the bill for two reasons:
 
 1) It ignores trailing spaces.
 2) It counts characters, not bytes, which makes a difference for nvarchar.
 
 --
 Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
 
 Books Online for SQL Server 2005 at
 http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
 Books Online for SQL Server 2000 at
 http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
 [Back to original message] |