May 5 2010

Quicker RowCount in SQL Server 2005/2008

I needed to get a rowcount for a particular table within a customers database today, so I fired off my normal query:

1
2
SELECT COUNT(1) 
FROM < <TABLENAME>>

And I got my row count back (incdidently, it was just over 325,000), but it was taking almost 10 seconds to return. Not Good!.
Continue reading


Jun 29 2009

To Debug, or not.

A SSIS package I wrote for a customer has all of a sudden stopped working correctly. Whilst no errors are raised, and the job completes successfully, it appears to “stop” on the very first task.

As the server the package is running on already had Visual Studio with “BITS” installed, I thought I’d just open the dtsx file up, hit debug and trace through it.
Imagine my surprise when, after opening the package, I found the “debug” options all greyed out!

After a bit of mucking around, I discovered that although you can debug a dtsx package, it first needs to be opened as part of a project, rather than directly as in my case. So, after creating a new project and simply adding in the dtsx package, I’m able to step through line by line..
Although it’s nothing major, it just seems a bit long winded.

What I’d also like to see is the ability to open packages that are already imported into SQL Server and then step through them immediately – that’d be cool :)