Wednesday, 21 September 2011

SQL Relay National and Local Prizes

Today I found out what a great prizes are being offered at SQL Relay..

If you come along to one of the local events (running between 3rd to 5th October: In Birmingham, Manchester, Farnham, Kent, Bristol, London, Hatfield, Leeds, Southampton, Edinburgh, Cardiff, Exeter, Cambridge, Essex and Maidenhead)

Not only will you have the chance to go home with one of the following prizes. 

But you will also be entered in a draw for the following prizes;

Its an amazing list of prizes!

The SQL Relay ‘Finishing line’ event on the 6th of October where Itzik Ben-Gan will be speaking is very close to being fully booked!

So register now before its too late!


A big thank-you goes out to all the companies that have sponsored the SQL Relay.

Friday, 16 September 2011

SQL Relay Swag from Red Gate

Another day, another parcel...
This time an intriguing small box from Red Gate.

I could tell it was from Red Gate.. the red box, the Red Gate logo.. all clues..

Two Red Gate t-shirts and two Red Gate pens.

So two lucky people are going to get Red Gate t-shirts at the next Southampton SQL Server User Group.

The SQL Community in the UK will be hosting its first SQL Relay, a series of events culminating in Itzik Ben-Gan (SQL Server Author and MVP, Co-Founder of SolidQ) presenting at Microsoft’s London HQ, Cardinal Place on the 6th October.
Southampton's SQL Relay event is on the 5th of October, Justin Langford (Coeo) will be talking about SQL Server Denali and Nicholas Colebourn will be discussing designing tables for scale.

Tuesday, 13 September 2011

SQL Relay Swag from Wrox

When I got in from work today there was something waiting for me… 
The swag from Wrox for the SQL Relay
Coasters, key rings, pens, stickers and a copy of Professional SQL Server 2008 Internals and Troubleshooting.  Justin Langford one of the authors will speaking at Southampton SQL Server User Group’s SQL Relay event on Wednesday 5th of October. [I will see if he will sign it! The book is staying in its plastic covering until the SQL Relay event]
SQL Relay is a series of SQL User Groups happening up and down the country between the 3rd and 6th of October,
Events are happening in: Birmingham, Manchester, Farnham, Kent, Bristol, London, Hatfield, Leeds, Southampton, Edinburgh, Cardiff, Exeter, Cambridge, Essex and Maidenhead..
See you there!!

Saturday, 10 September 2011

SQL Relay–Filling up fast.

The SQL Relay events are booking up fast; over 239 people have registered so far.

So register as soon as possible to avoid disappointment!!

If you know you can’t make it, unregister – it will mean someone else can go in your place.

The London (finish line) Event is 70% booked already!

SQL Relay is part of the National SQL Server Week, which starts with SQLBits on the  29th of September and finishing with Itzik Ben-Gan presenting at the finishing line event.

For details of the SQL Relay visit

SQLBits + SQLRelay = National SQL Server Week

Thursday, 8 September 2011

National SQL Server Week

From the 29th of September to the 6th of October, it’s the first National SQL Server Week in the UK.

SQLBits + SQL Relay = National SQL Server Week

29th September - Day 1 - Thursday - SQLBits Training Day

30th September - Day 2 –Friday - SQLBits Conference Day

1st October - Day 3 –Saturday - SQLBits Conference Day (Free)

2nd October - Day 4 - Sunday – Rest, Ahhh....

3rd October - Day 5 – Monday - SQL Relay Day 1 - Birmingham  ~   Farnham, Surrey  ~   Kent  ~   Manchester  (Free)

4th October - Day 6 – Tuesday - SQL Relay Day 2 - Bristol  ~   Hatfield  ~   Leeds  ~   London  ~   Maidenhead  (Free)

5th October - Day 7 – Wednesday - SQL Relay Day 3 - Cambridge  ~   Cardiff  ~   Edinburgh  ~   Essex  ~   Exeter  ~   Southampton  (Free)

6th October - Day 8 – Thursday - SQL Relay Finish Line - London - Cardinal Place  (Free)

Where else can you get 7 days of SQL?

Tuesday, 6 September 2011

Essex, Cambridge and Maidenhead…

What do Essex, Cambridge and Maidenhead all have in common?

Yes – you guessed it!

They all have new SQL User Groups (UG) and they are all joining in the SQL Relay!  A Four day SQL-a-thon, a series of events culminating in Itzik Ben-Gan (SQL Server Author and MVP, Co-Founder of SolidQ) presenting at Microsoft’s London HQ, Cardinal Place on the 6th October.

Check out the SQLServerFAQ site for details of your nearest community event.

Wednesday, 31 August 2011

How to write a SQL Server Management Studio Add-in for Denali (CTP3) (Part 2)

In my previous post on writing a SSMS Add-in for Denali I detailed the steps that you would need to take to get the Add-in loaded and running but it didn’t do a great deal.

Now we take it a step further. But not too far(!)

I’ve done a number of things;


1) As we all know, SSMS Add-in’s only work because of a deep dark magic, but there are a few ways we can peek inside to see what’s happening.  


The DTE object we get during the OnConnection method has a class full of events – so lets hook them up and see what happens.



  EnvDTE.TextDocument doc = (EnvDTE.TextDocument)ServiceCache.ExtensibilityModel.Application.ActiveDocument.Object(null);


Returns a TextDocument object from which you can get the contents of the window (SQL).


3) Just like previous versions add-ins, you use the same code to pick up Object Explorer events.

   1:                 objExplorerService = (ObjectExplorerService)ServiceCache.ServiceProvider.GetService(typeof(IObjectExplorerService));
   2:                  cs = (ContextService)objExplorerService.Container.Components[0];
   3:                  cs.ObjectExplorerContext.CurrentContextChanged += new NodesChangedEventHandler(ObjectExplorerContext_CurrentContextChanged);

Download the source from codeplex, check it out, play with it, check it in!

Saturday, 27 August 2011

SQL Relay - 3 Countries, 4 Days, 16 Events.

You wait ages for a User Group, then a whole load turn up all at once!!

Between the 3rd and 6th of October, up and down the UK the SQL community is coming together; this phenomena is known as SQL Relay.

Events are happening in (deep breath): Birmingham, Manchester, Farnham, Kent, Bristol, London, Hatfield, Leeds, Southampton, Edinburgh, Cardiff, Exeter, Cambridge,Essex and Maidenhead.. {and a partridge in a pear tree}.

3 Countries, 4 Days, 16 Events.

So if you have never been to a User Group or go all the time, have only just heard about SQL or are waiting for Denali to hit the streets – get along to one of the SQL Relay events.

[Updated 7/9/2010]  Itzik Ben-Gan (SQL Server Author and MVP, Co-Founder of SolidQ) will be presenting at Microsoft’s London HQ, Cardinal Place on the 6th October.

And all this right after SQLBits 9 in Liverpool - 3 days of top SQL Server content given by SQL Server Experts from around the world, including Microsoft Certified Architects (MCA), Microsoft Certified Masters (MCM) and Microsoft Most Valued Professionals (MVP).  If you have not already registered, then you better hurry!

Thursday, 25 August 2011

Southampton SQL Server User Group is now a PASS chapter

The Southampton SQL Server User Group (SSSUG) has now been accepted as a PASS chapter (The Professional Association of SQL Server).

We are the 5th UG in the UK to become a chapter.

It's really Jonathan Allen’s fault. I saw his User Group up on the PASS site and thought we need to be part of this!

So what is PASS? Well, its mission statement says it all; ‘Empower the global Microsoft SQL Server and Business Intelligence community to connect, share, learn and be inspired through networking, knowledge sharing, peer-based learning, and the ability to influence the direction of Microsoft SQL Server data platform.

It’s certainly a lot to live up to, but I’m sure we are up to it!!

Saturday, 20 August 2011

How to draw a Polygon in SQL Server

In my previous post 'Drawing a circle in SQL Server (almost)' I showed how to plot 360 points to draw a circle. {Well} It looked like a circle, but to SQL Server, it was just a series of points.

We can use a LineString to draw a shape, but the most appropriate type is the Polygon.

The polygon is a closed [at least 3 sided] shape, i.e. the first point is the same as the same point. If it’s not, SQL will throw an exception. SQL Server will also throw an exception if you attempt to create a polygon with just two sides..


   1:  -- Drawing a polygon
   2:  declare @Sides float = 3
   3:  declare @count int = 0
   4:  declare @size int = 10
   5:  declare @firstpoint varchar(400)
   7:  declare @sql varchar(8000);
  10:  set @sql =  'POLYGON((' 
  12:  while(@count < @Sides)
  13:  begin
  15:  set @sql = @sql + cast(SIN(RADIANS((CAST(@count AS FLOAT)
  16:              /CAST(@Sides AS FLOAT)) 
  17:              * 360)) * @size as varchar) 
  18:             + ' ' +
  19:              cast(COS(RADIANS((CAST(@count AS FLOAT)
  20:              /CAST(@Sides AS FLOAT))
  21:              * 360)) * @size as varchar) + ','
  23:  if @count = 0
  24:  set @firstpoint  = cast(SIN(RADIANS((CAST(@count AS FLOAT)
  25:              /CAST(@Sides AS FLOAT)) 
  26:              * 360)) * @size as varchar) 
  27:             + ' ' +
  28:              cast(COS(RADIANS((CAST(@count AS FLOAT)
  29:              /CAST(@Sides AS FLOAT))
  30:              * 360)) * @size as varchar) 
  32:  set @count = @count + 1
  34:  end
  36:  set @sql = @sql + @firstpoint + '))'
  38:  print @sql
  39:  DECLARE @g geometry;
  40:  SET @g = geometry::STGeomFromText(@sql, 0);
  41:  select @g

Simply change

   1:  declare @Sides float = 3

to be how ever many sides you need.  Simple.

Here are a few examples.


All scripts can be found on my SkyDrive using the link below.

SQL Server in the Evening (3rd Event)

Last night I did my first slot as a presenter.  I’d like to thank Gavin Payne, the event organiser for giving me the opportunity to speak.

So how I did go? Okay, I think.  It is very difficult to know how you go down until you get feedback (so if you attended, please feel free you email me your comments). 

The initial feedback was positive and incredibly useful (Thank-you Christian), its given me ideas of how to structure my next presentation… 

But back to the evening…

My presentation was on Geospatial data types in SQL Server 2008 (r2 Express) – to try and make my presentation more memorable I used props, balls for Points, string for LineString and Polygons –> I hoped that it would be different , not in code or PowerPoint would help the concepts stick..   

me_at_sql_in_the_evening If you look really closely you can see the string.. (Thanks again Christian – I took no pictures all evening).

After me, Vilosh (Smart Reporting Solutions) did a demo of his BI product.

Then the buffet,  although I feel the term buffet doesn’t do justice to food.  I was bowled over by the quality and quantity.  The Ramada did a great job.

Then Jen Stirrup presented iPad and PowerPivot- Mobile Business Intelligence in Action.  A really thought provoke presentation on the future of mobile BI and BI in general.  The iPad is a game changer and a great business tool.  Check her previous and next SQLBits sessions out.

Next up was Keith Burns presenting Denali CTP3 - An overview and update.  I was excited about CTP1 of Denali, but it was a bit of a non-starter, yes, it was a new engine and new SSMS, but the cool sexy features, Crescent, Column Store indexes, file table, Juneau etc etc were all missing, but now in CTP3 – they are all there!!!!!!

I feel like it’s time to get enthusiastic about Denali again.  Keith briefly mentioned Feature pack for Denali…Check out the goodies!!

One of the great things about going to User Groups is seeing wonderful presenters talk about subjects they love, but its a fantastic place to meet up with the twitterati – people you only know by cryptic code names are real flesh and blood people.  

I’d like to thank Gavin again for putting on a great evening and I’m really looking forward to the next one.

Friday, 19 August 2011

'Denali' Community Technology Preview 3 (CTP 3) Feature Pack

I was at Keith Burn’s presentation of ‘What’s new in Denali CTP3’ at SQL Server in the Evening (Gavin Payne’s User Group) last night and I heard about Denali Feature pack.

A small about of googling with Bing later, this popped up -  ‘Feature Pack pour SQL Server "Denali" CTP3’

I had a Homer Simpson moment ”Hmmm Feature Pack...”

Wednesday, 17 August 2011

How to write a SQL Server Management Studio Add-in for Denali (CTP3) (Part 1)

Writing a SSMS Add-in is not for the faint hearted or those with weak constitutions, but for those who persevere the rewards are small and fleeting, yet worth while.

This post is for people who know roughly what they are doing, so without any more non-sense, here we go.

You will need;
                       Visual Studio 2010 (I have Premium - I've not tried other editions)
                       SQL Server Denali CPT3 (Should work with CTP1 and CTP2 - but I've not tried)
1) Start up VS2010

2) Create a new project, a Visual Studio Add-in, you should find this under 'Other Project Types \ Extensibility'  (You may not have this project type, do not panic! I will make this source available)

3) Give the project a sensible name - like MyAddin1 :-)

4) The Add-in Wizard should start, 'Click Next'

5) Pick you language of choice, I picked 'Create an Add-in  using C#' (C++/CLR and C++/ ATL are both greyed out for me) - Click Next.

6) Un-Select 'Microsoft Visual Studio 2010 Marcos' - Click Next.

7) Give your Add-in a sensible name and description. - Click Next.

8) Tick 'Yes, create a Tools menu Item...' and 'I would like my Add-in to load...' - Click Next.

9) Its up to you if you want a 'Help About' box. - Click Next.

10) Click Finish.

You are almost ready, we just need to sort out the Add-in registration.

Your new Add-in will be already setup to be a Visual Studio 2010 Add-in.
We just need to customise it a bit, so that SSMS recognises it.

11) VS2010 has created you two .Addin files, delete the 'MyAddin1 - For Testing.AddIn'

12) Locate the 2nd .Addin file, it will be somewhere like; c:\users\XXXX\documents\visual studio 2010\Projects\addin\MyAddin1\MyAddin1\MyAddin1.AddIn
Move it to C:\Users\Public\Documents\microsoft\MSEnvShared\AddIns

This is the folder that SSMS is looking for Add-in files.
[Update 19/08/2011: You may need to create the MSEnvShared\AddIns path.  Thanks to Raphael for spotting this]
[Update 19/05/2012: For the final release of SQL Server 2012, the .Addin file must go in the C:\ProgramData\Microsoft\MSEnvShared\AddIns folder]13) You can now delete the MyAddin1.Addin from your project.

14) Edit the C:\Users\Public\Documents\microsoft\MSEnvShared\AddIns\MyAddin1.Addin' file.
Change the top section from :

<HostApplication>   <Name>Microsoft Visual Studio</Name>


to be:

<HostApplication>   <Name>Microsoft SQL Server Management Studio</Name>



Update the Assembly to be the full path to your DLL.
<Assembly>c:\users\XXXXX\documents\visual studio 2010\Projects\addin\MyAddin1\MyAddin1\bin\Debug\MyAddin1.dll </Assembly>

14) Update the Project Properties, in the Debug section, update Start external program to be C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\ManagementStudio\Ssms.exe (Of course, update this if you have installed Denali somewhere else)

15) Turn off P-Invoke warnings. Press CRLT + ALT + E - In Managed Debugging Assistants, find PInvokeStackImbalance, untick it.

16) Add a break point to the Connect() line, Hit F5 and run for the hills - because you should have a SQL Server Management Studio Add-in working.

The Add-in doesn't do very much yet, I will save that for another post. 

But you have an Add-in running, which was easier to write than Add-ins for SQL 2005 and 2008.

The only tricky, bit was the location and contents of the .Addin file.

Have fun writing your own Add-ins!!
[Updated 19/08/2011: I’ve got to say thanks for Mladen Prajdić for the telling me what the version needs to be in the XML]

Sunday, 7 August 2011

Can not connect to SQL Server remotely

Having trouble connecting to a new instance of SQL on a new Windows 2008 install?

Took me longer to work out than I care to admit.

I checked all the basics, allow remote connections, browser service running etc.etc..

Answer: Turn off Windows Firewall!! DOH! (Or at least add the SQL ports to the allowed list!)

SQL Server User Group in Southampton 10th August

The next Southampton SQL Server User Group is on the 10th of August.

Neil Hambly (@Neil_Hambly | web ) and John Martin (@SQLServerMoney) are both presenting - for more details check out the website.

See you there!!

Thursday, 28 July 2011

Drawing a circle in SQL Server (almost)

I've just started playing with the Geo spatial data types in SQL Server 2008 R2 Express.
The first thing I wanted to do was draw a circle.  How difficult could it be?

I could not find an example on the interweb - so I put one together.

   1:  DECLARE @Points AS FLOAT = 360;
   3:  DECLARE @count AS INT = 0;
   5:  DECLARE @size AS INT = 1;
   7:  DECLARE @tmpTable TABLE (
   8:      geo geometry);
  10:  WHILE (@count < @Points)
  11:      BEGIN
  12:          INSERT INTO @tmpTable
  13:          SELECT geometry::STGeomFromText('POINT(' + CAST (SIN(RADIANS((CAST (@count AS FLOAT) / CAST (@Points AS FLOAT)) * @Points)) * @size AS VARCHAR) + ' ' + CAST (COS(RADIANS((CAST (@count AS FLOAT) / CAST (@Points AS FLOAT)) * @Points)) * @size AS VARCHAR) + ')', 4326) AS Posn;
  14:          SET @count = @count + 1;
  15:      END
  17:  SELECT geo
  18:  FROM   @tmpTable;  

Now choose the 'Spatial Results' tab - you might have never seen this before. It only appears if the results set has a geospatial data type in it.

The observant of you might notice, it's not actually a circle. Just 360 different point (there is a different!) But I'll cover that in my next blog post.

[UPDATED: Added link to scripts]
All scripts can be found on my SkyDrive using the link below.

Monday, 18 July 2011

Southampton SQL User Group Next Events

[Updated: For latest news and events at Southampton SQL User Group follow this link]

I've been busy organising the next events for the Southampton SQL User Group and here they are.

10th August, John Q Martin and Neil HamblyDetails
7th September, Jessica Meats and Simon Sabin (MCM/MVP)Details
5th October, Justin Langford (MVP) and TBCDetails
One year Anniversary 
9th November, Allan Mitchell  and James Rowland-Jones


For details of your local SQL Server User Group visit

Sunday, 17 July 2011

SQLBits 9 - Session submission


I’ve finally done it, I’ve submitted a session for SQLBits 9!!


God news knows if it will be picked, but it will only get picked if people vote for it!!!


So get on and vote!! If not for me, then someone else!

Saturday, 16 April 2011

SQL Server User Groups in the UK!!

I tried to get this list together before SQLBits 8, but failed.  It contains SQL Server User Groups and the postal code of where it was held.  I've included SQLBits (for fun!).  Its not every single one thats ever happened, buts ones that have happened over the last 7 or 8 months. I apologise if I've missed you off!!

UG Name,City,Postcode
Scottish Area User Group,Edinburgh,EH1 3EG
SQL Herts,Hatfield,AL9 5HZ
Leeds User Group,Leeds, LS3 1EP
Manchester User Group, Manchester, M1 3HU
SQLSoton,Southampton,SO17 1XQ
Cardiff User Group,Cardiff,CF10 5BT
Bristol User Group, Bristol,BS1 4QD
Kent SQL Server and .NET User Group,Maidstone,ME14 1ED
Birmingham User Group,Birmingham,B2 5NY
Surrey User Group,Camberley,GU16 7ER
Bracknell User Group,Bracknell, RG12 1AQ
Dundee User Group,Dundee, DD1 4HN
Reading UG,Reading, RG6 1WG
London UG,London, EC4M 7AN
Cambridge UG,Cambridge,CB4 0WZ
BCS,Telford, TF2 9FT
SQL SouthWest,Exetor,EX1 1JJ
SQLBits 8,Brighton, BN1 2FW
SQLBits 7,York,YO10 5DD
SQLBits 6,London,SW1P 3NZ
SQLBits 5,Newport,NP18 1HQ
SQLBits 4,Manchester,M15 6BH
SQLBits 3,Hatfield,AL10 9AB
SQLBits 2,Birmingham,B4 7ET
SQLBits 1,Reading, RG6 1WG

Link to these points on a bing map

*SQL SouthWest postcode is a guess.

Thursday, 14 April 2011

The SQLBits 8 Community Corner Map!

After 2 days of pinning, this is the result....The SQLBits 8 Community Corner Map!

I would like to thank all the people that came to Community Corner and stuck pins in the map and all the very kind non-UK people that took the time to draw their own countries (including Italy, Germany, Holland, Sweden, Norway, Denmark, Austria and Australia ) and pin them on the map.

Here is all your work.......

I have to thank all the people who stayed in Community Corner and represented the SQL Communities in the UK! - You know who you are!!! Finally we have to thank the SQLBits committee who gave us the opportunity to have community corner.

See you at the next SQLBits!!

Red pins = User Groups , Blue Pins = People..

Friday, 4 March 2011

T-SQL Tidy SSMS 2008 R2 released...

Tonight I've finally done it, posted up the R2 version of the SQL Server Management Studio Add-in.

You can download it from here;

It's got some new features!!!
  • Local formatting (no longer uses the web service - so no internet connection required)
  • Lots and lots of formatting options.
  • Format SQL to HTML!
So on give it a go, what have you got to lose?

Thursday, 17 February 2011

Comments now supported on web site and in SSMS add-in!

After a very very long long long long time, I've finally got support for single and multi-line comments.

Many many thanks to Matt (@atlantis_uk ) at without who the site would be comment less.

So enjoy! Its not 100% perfect, there are some HTML formatting issues, but I felt I needed to get this release out there.

If you are using the SQL Server Management Studio Add-in, comments are now automatically supported.

So enjoy well formatted SQL and HTML!!

Friday, 4 February 2011

SWAG from Redgate arrived!

The SWAG for the SQLSoton (SQL Southampton) User Group has arrived, Woo Hoo!

Red-Gate has sent;
USB Keys preloaded with some Ebooks.
Red-Gate stickers.
and what I think are luggage ID tags (made from real cow).

A huge thanks to the peeps at Red-Gate for sending over this SWAG - there will be many happy faces at the next UG.

So if you want your share, come to the User Group on the 9th Feb... details here.

Tuesday, 25 January 2011

SQLSoton (SQL Southampton) User Group dates..

Here are the User Group dates for the next few months:
  • Feb 9th
  • March 9th
  • April 13th
  • May 11th
  • June 8th
Go to to register.

See you there!!

Monday, 24 January 2011

Your User Group needs you.[Big pointy finger]

The SQL Server User Group in Southampton (@SQLSoton ) needs you!!

If you are an experienced speaker or just want to try presenting for the first time then get in contact with us! We are looking for presentation between 15 and 60 minutes.

Dont just sit there and think about it, send us an email and you could be presenting next month!

Thursday, 20 January 2011

Cultural Learnings of User Group (dis)Organiser for Make Benefit Glorious Nation of SQL Server


I think that about sums it up; WOW!!!

Before I get all gushy, I just want a quick Oscar moment - I would firstly like to thank every person that came, without your support there would be no User Group.

Secondly, I’d like to thank @AdaTheDev (Adrian) and @atlantis_uk (Matt) for organising and sorting out the Feng shui.

And of course @ChristianBolton, for being our crowd pulling speaker. I’m sure the turnout would not have been so high without him.

Come to User Group, It's Nice!

Be careful what you wish for as it just might happen. I was expecting a few more people to turn up this time, but based on previous experience I was expecting 9 or 10. I was not expecting to more than double the turnout; 15! Every chair in the room (which was bigger than last time) was taken…

So my learnings are – You have no idea how many people will turn up until 7.10pm.


I ordered the food based on the number of people I was expecting. Since all the food was gone, even the biscuits,… I don’t think there was enough! I’ve been tweeting @GavinPayneUK about the pizza to persons ratio.

So my learnings are – order more!

We were trying out a new room, so Matt, Adrian and I spent a while working out the best room configuration before the geeks the punters arrived, which worked well. Once Christian had finished his talk and I’d got back with my inadequate supply of pizza, people eat, chatted.  But as Matt pointed out we should have put the chairs away to free up space in the room.

So my learnings are – work out the best use of space in advance.


For the first UG, I created some feedback forms which never got used as there were so few of us. Okay, I’ll put my hands up and say I didn’t create the feedback form; @ctesta_oneill did. I just changed the name of the UG at the top! But I did click print… (Don’t think I even convinced myself). We really could have done with them. Even if it was just a way of keeping track of who turned up.

So my learnings are – Don’t throw away feedback forms.


Now I’m eagerly checking twitterverse and blogosphere to see what people thought….  If you were there, you too can improve the cultural learnings of User Group (dis)organiser for make benefit glorious nation of SQL Server [Please tweet or blog your thoughts…  I promise not to get offended!!]

See you all in Feb!!!