Archive

Author Archive

New project

August 26th, 2010 admin No comments

I’ve had an Android phone for quite a while now, and has been wanting to make some-kind-of-app for it for a long time, but now seems to be a good time to start something up.

Android SDK installed – check, Netbeans and Nandroid plugin installed – check. Hello world compiled and running on SDK – check.

Now all I need to do is find a suitable project, and start coding :)

Categories: android Tags: , , ,

All Quiet on the Western Front

August 26th, 2010 admin No comments

Hmm, haven’t really been paying too much attention to this blog lately. This will surely change soon!

Categories: Uncategorized Tags:

List all tables for MSSQL

February 16th, 2010 admin 1 comment

I’m currently replicating data from MSSQL2005 to MSSQL2000, which has proven a bit of a PITA. I succeeded using transactional replication, but afterwards I needed to verify all data has been copied. Tables without primary key (stupid, I know) has not been replicated, and some views referencing missing tables or databases are not either (probably shouldn’t anyway).

However, it’s pretty damn useful to just get a list of tables with count of rows, which led me to this blog post.

The SQL code needed is this:

USE DatabaseName
GO
CREATE TABLE #temp (
table_name sysname ,
row_count INT,
reserved_size VARCHAR(50),
data_size VARCHAR(50),
index_size VARCHAR(50),
unused_size VARCHAR(50))
SET NOCOUNT ON
INSERT #temp
EXEC sp_msforeachtable 'sp_spaceused ''?'''
SELECT a.table_name,
a.row_count,
COUNT(*) AS col_count,
a.data_size
FROM #temp a
INNER JOIN information_schema.columns b
ON a.table_name collate database_default
= b.table_name collate database_default
GROUP BY a.table_name, a.row_count, a.data_size
ORDER BY CAST(REPLACE(a.data_size, ' KB', '') AS integer) DESC
DROP TABLE #temp
Categories: sql Tags: , ,