Posted by Erland Sommarskog on 06/12/07 21:32
M A Srinivas (masri999@gmail.com) writes:
> 2. Here i want know the space occupied by the field name "description"
> for the product id=1.
>
> SELECT SUM(DATALENGTH(description)) FROM table
> WHERE product_id=1.
Should be:
SELECT SUM(2 + DATALENGTH(description)) FROM table
WHERE product_id=1.
Add 2 for the length stored for the field.
--
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
Navigation:
[Reply to this message]
|