Posts by Tim:
Determing SQL Server Table Size
This is a bit of code I found that determines the size used by each table in your database.
Make sure you run DBCC UPDATEUSAGE first to correct any incorrect stats (pages etc) on your tables.
DBCC UPDATEUSAGE (YOUR DATABASE NAME)
--Cursor to get the name of all user tables from the sysobjects listing
DECLARE tableCursor CURSOR
FOR
select [name]
from dbo.sysobjects
where OBJECTPROPERTY(id, N'IsUserTable') = 1
FOR READ ONLY
CREATE TABLE #TempTable
(
tableName varchar(100),
numberofRows varchar(100),
reservedSize varchar(50),
dataSize varchar(50),
indexSize varchar(50),
unusedSize varchar(50)
)
OPEN tableCursor
FETCH NEXT FROM tableCursor INTO @TableName
WHILE (@@Fetch_Status >= 0)
BEGIN
INSERT #TempTable
EXEC sp_spaceused @TableName
FETCH NEXT FROM tableCursor INTO @TableName
END
CLOSE tableCursor
DEALLOCATE tableCursor
--Select all records so we can use the reults, ordered by biggest
SELECT *
FROM #TempTable
ORDER BY CAST(LEFT(dataSize,LEN(dataSize)-3) AS NUMERIC(18,0)) DESC
DROP TABLE #TempTable
References:
You receive a “The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect” exception when using NVarchar parameters with Sqlclient
The problem I got the following random error: You receive a “The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect” exception when using NVarchar parameters with Sqlclient The Solution Its a known bug with the .Net SqlClient Data Provider. If you have a field in the database of type nvarchar(max) [...]
Open XML – OLE Automation Date Issues
If you are exporting a date from C# to Excel using 2007, you probably will use the following: Math.Round(DateTime.Now.ToOADate(), 12).ToString() This exports the date as a OLE Automation date recognized by Excel 2007. How ever, in Excel 2010 this was causing issues, every time I exported to Excel 2010, it said that it has to [...]
New Photo – CheckoutChristchurch.co.nz south by the Church of Good Shepard
CheckoutChristchurch south on Lake Tekapo by the Church of Good Shepard!
PRODUCT OF THE WEEK – CAR FIRST AID KIT
PRODUCT OF THE WEEK: Car First Aid Kit – Perfect kit for the car for any unexpected accidents on the road! Includes plasters, saline, CPR mask plus more..perfect if you are traveling up the snow this winter! http://www.medicsafe.co.nz/car-fa-kit-soft-pack
Auckland 2011 Website Hickups!
Auckland 2011 Website isn’t too bad but it has a few design flaws! Can you spot them? This appears across all browsers, look closely where the Visitor Services text is.
EF Strongly Typed ObjectQuery.Include
The problem that I faced was having to put up with “hard coded” strings in the ObjectQuery.Include function to load related objects through POCO objects in the Entity Framework. This faced challenges when I renamed columns in the Model which caused a run-time error when recompiling and re-starting the application. Thanks to David Kiff, we [...]
Fixing the EF Tracing and Caching Provider Wrapper Issue
If you have been using the Tracing and Caching Provider Wrappers for the ADO.NET Entity Framework 4.0, you might of come across this error message when creating POCO objects, adding them to a Data Context and commiting them to the database using the Caching Wrapper: [NotImplementedException: The method or operation is not implemented.] EFCachingProvider.EFCachingDataReaderCacheWriter.GetName(Int32 ordinal) [...]
CheckoutChristchurch – What not to check out??
Here is a picture that was taken from outside Timaru..perhaps this picture has failed? www.checkoutchristchurch.co.nz
CheckoutChristchurch has a new pic! Clock Tower
Visit http://www.checkoutchristchurch.co.nz to see the Victoria Street Clock Tower in Christchurch! www.checkoutchristchurch.co.nz is powered by jquery, flickr and a twitter feed!


