December 21, 2010 at 10:07 am
Hi,
I'm trying to find the space consumed by a single column in a table.I'm able to find the total size of the table by using sp_spaceused but to further investigate I need to know how much space is used by each column?
December 21, 2010 at 10:11 am
SELECT SUM(DATELENGTH(ColName)) As Bytes FROM dbo.table
December 21, 2010 at 10:12 am
That will take a bit of extrapolation. If you know the data types, and by knowing the storage requirements for the data types you can begin calculating the space usage of your columns.
Here is an article to help with storage requirements of data types:
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
December 21, 2010 at 11:43 am
SELECT SUM(DATALENGTH(colname)) As Bytes FROM db.table...will this work for ntext datatype?
December 21, 2010 at 11:57 am
pkposani (12/21/2010)
SELECT SUM(DATALENGTH(colname)) As Bytes FROM db.table...will this work for ntext datatype?
What version of SQL Server are you running?
NText was Deprecated in SQL 2005
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
December 21, 2010 at 12:01 pm
I'm restoring a SQL 2000 DB to a 2005 enterprise edition and running in 2000 compatible mode..
Thanks,
Pavan Posani
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply