Pages

Sunday 24 October 2010

How to start a regional group and be part of the UK SQL Server User Community

Tony Rogerson posted this really guide on 'How to start a regional group and be part of the UK SQL Server User Community'

It's a "must read" for any one wanting to start a regional group.

Thursday 7 October 2010

Are you trying to tell me something...


This was on the fridge when I got home...

I think my wife was trying to tell me something, but I've not worked it out yet.


Whoop!! Whoop!! Site Down!!!

Just checked tsqltidy.com and it's down!
Grrrrr....

*Amendment:
DOH! It was my fault, some dodgy coding around a twitter feed.
Oh well. Wont do that again (for a few months!).

Wednesday 6 October 2010

Finding Non-SARGable queries

I was in Rob Farley's sessions at SQLBits when he was talking about: Understanding SARGability (to make your queries run faster)

It got me thinking....
Is there a way I can find out which SQL queries are doing table or index scans?
So I put some proof of concept code (POC) together.

SELECT top 10 text ,query_plan ,*
FROM sys.dm_exec_query_stats
CROSS APPLY sys.dm_exec_query_plan(sys.dm_exec_query_stats.plan_handle)
CROSS APPLY sys.dm_exec_sql_text (sql_handle)
WHERE
CONVERT(varchar(max), query_plan) like '<tablescan%'
OR
CONVERT(varchar(max), query_plan) like '<IndexScan%'
ORDER BY total_elapsed_time desc;

Its not a very sophisticated query (it only took a few minutes to write and yes, I agree, I should shred the xml instead of using a convert and like) but it shows the concept of querying the execution plans to get details of queries that has run (rather than the best way of getting the information).

It takes a while to run so don't go running it in LIVE, and might bring back some false positives - so please be careful with the results.


References:

Tuesday 5 October 2010

Gadget Show Top 5 Budget Mobile Phones

I've been trying to find this list all day and its nowhere on the Gadget Show website.

It's...

1) Samsung Genio Qwerty
2) LG KS365
3) Huawei U7510
4) INQ Mini 3g
5) Alcatel OT808

How to setup a MSSQL Server Management Studio (SSMS) 2008 New Query Template

It took me a small amount of Googling with Bing to find this post on Stack Overflow.

But it works for SQL 2008 r2 - apart from changing the paths slightly.

%Install Dir%:\Program Files\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\SqlWorkbenchProjectItems\Sql\SQLFile.sql

I cant work out why is there nothing on MSDN about this cool feature?
Or why is not part of the SQL templates.


References:
http://sqlsoundings.blogspot.com/2010/03/using-ssms-templates-for-fun-and-profit.html
http://msdn.microsoft.com/en-us/library/ms174169.aspx
http://stackoverflow.com/questions/593047/mssql-server-management-studio-ssms-2005-new-query-template