Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Count the Number of bytes

Author  Topic 

pvccaz
Yak Posting Veteran

87 Posts

Posted - 2009-01-12 : 19:14:10
Hi,

Is there any command that can count the number of bytes of the data in a column that is stored in a table.

For example there is a column called as Emp_name in table EmpTbl.
I want to find out the number of bytes of every name stored in the Emp_name column. Is there any built in function for this ?.

Thanks

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-01-12 : 19:15:01
Check out LEN and DATALENGTH functions in SQL Server Books Online.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

pvccaz
Yak Posting Veteran

87 Posts

Posted - 2009-01-12 : 19:25:58
Thank You !!..Looks like DATALENGTH returns the length of the string in bytes, including trailing spaces.
Go to Top of Page
   

- Advertisement -