The Bit Bucket

OT: Airlines and Podcasts

Those that know me know that I spend an inordinate amount of time on airlines. I also love podcasts, as you can tell from my www.sqldownunder.com site and show. So anything that combines the two is just awesome.

Fly With Joe fits that perfectly. Joe D’Eon provides great insights in his show. I was sad last year that he hadn’t posted many shows. I’ve also been quiet for a couple of months (but that’s about to change with a bunch of SQL Server 2008 R2 shows). But I’ve been so pleased that Joe’s got back into the cockpit on his show lately. And also providing some live streaming shows. Recommended!

2010-03-20

SQL Server 2008 R2 - Application and Multiserver Management Learning Materials

My colleagues and I have been working with Microsoft to produce the Metro training materials for SQL Server 2008 R2. We’ve using those materials to train other trainers around the world. (If anyone will be in Reading in the UK next week, ping me and say “hi”. Same for London the following week).

Roger Doherty’s group have been hard at work turning these materials into consumable bite-sized pieces of training. This involves videos, demos and hands-on-labs.

2010-03-04

SQL Server Reporting Services: Should support include files

It’s common to want to embed custom code within reports in Reporting Services. One thing I don’t like is the inclusion of anything that looks like business logic directly in the reports. However, formatting functions, etc. seem totally appropriate.

If I want to embed custom code within Reporting Services though, I currently have two options. One is to embed the code in the report, the other is to reference an assembly. Each of these has drawbacks.

2010-02-19

DevWeek in London - coming up in March - early bird ends soon

DevWeek is on again this year.

Should be good to catch up with many of my European colleagues again. DevWeek is on March 15 - 19 at the Barbican Centre in London. The early bird pricing runs till 19th February.

A number of my colleagues will be speaking as well: Itzik Ben-Gan, Javier Loria and Davide Mauro.

I’m looking forward to seeing them and all the SQL crowd that will make it to London for the event.

2010-02-02

New entry in the unbelievably-misleading error message category: Windows 7 x64 RDP Client

I spent quite a while earlier trying to make an RDP connection to another system on my network. The error message from the RDP client was:

Your computer could not connect to another console session on the remote computer because you already have another console connection in progress.

You can imagine the range of things I tried to resolve the issue.

The actual issue? The machine had a new IP address and I was trying to connect to its old IP address. Great error message :-(

2010-01-23

Stored Procedure Contracts - Return Values

Yesterday’s blog post on the need for contracts for stored procedures caused a lot of comments and email. One of the most interesting comments came from Jamie Thomson regarding return values. Jamie’s totally correct on this. Return values should be part of any contract.

I’ve been thinking further about how return values should be incorporated into a contract and initially thought it should be something like this:

CREATE OR ALTER PROCEDURE SomeSchema.SomeSproc (someparameters)

WITH CONTRACT SalesOrderHeaderAndDetails ENFORCED

     (ROWS OrderHeaders(SomeColumn INT, SomeOtherColumn NVARCHAR(50) NULL),

           OrderDetails(AnotherColumn INT, YetAnotherColumn INT, 

                        EvenYetAnotherColumn GEOGRAPHY),

      RETURNS INT,

      EXCEPTIONS NoSuchCustomer(50020,’No such Customer’),

                 DuplicateOrder(50022,’That order already exists’)),

     EXECUTE AS (execution options here if needed)

I thought the values could be RETURNS INT or RETURNS NULL, but on reflection (no pun intended), I realized that in many cases it is necessary to resort to documentation to know what a stored procedure return value is. That would be eased if the return value also had a name as part of its metadata. So perhaps a more complete contract would look like:

2010-01-20

SQL Server 2008 R2: StreamInsight Development Models

One thing that seems confusing to people when they first look at StreamInsight is that there are several development models:

1. Implicit Server

2. Explicit Server

3. IObservable/IObserver 

Implicit server is fairly straightforward. You define your input stream and create a query to consume your output stream. StreamInsight does all of the heavy lifting associated with creating the server, binding your adapters, etc.

Explicit server is the most flexible but the most coding work. You specifically spin up (create and instantiate) a server object, from it spin up an application, register your input/output adapters and create them via a factory and spin up a query binding object. You use the query binding object to bind together your standing query (via a query template) and your input and output adapters. You use this query binding object to then create a query object (an instance of a query) which you then start/stop as required. With the explicit server model, you can get reuse of query templates, adapters, etc. and you can reuse an existing event stream for multiple queries. This model is also how you’d work with a server that’s not hosted in-process if that’s required.

2010-01-19

Stored Procedures - Time for a real contract?

Increasingly, developers are using tools that try to automate code generation when dealing with databases. Stored procedures have been a thorn in the side of this. Mostly that’s because it’s difficult to obtain the metadata that is really needed.

RowSets

Most automated tools try to work out what rowsets can come back from the sprocs. The Entity Framework, LINQ to SQL and many others use SET FMTONLY ON to try to determine what might come back from the sproc. This is a flawed mechanism as it returns one set of metadata for every potential code path through the sproc. It really only works for the most trivial sprocs ie: single statements that perform basic CRUD operations.

2010-01-19

SQL Server 2008 R2 - StreamInsight - Event Payloads

One of the key decisions you’ll make when working with StreamInsight is the payload that will be carried by each event. Events contain and EventKind (which is related to whether they’re inserting a new event or modifying an existing one), some temporal information (depending upon the EventShape -> Point, Interval or Edge) and a payload that is user-defined.

A payload is defined via a .NET class or struct. In general, a class will be a better option as it ensures field ordering which is likely to be important for generic (vs typed) adapters. StreamInsight ignores anything except public fields and properties and there are limitations on the data types. For example, basic .NET types are permitted but not any of the nested types.

2010-01-16

SQL Server 2008 R2: Reporting Services - Pagination

Another item I had on the Connect site was about pagination. I wanted to be able to restart page numbering within a report. In my case, this was because I wanted to output a set of invoices in a single report but I wanted each invoice to have its own set of page numbers.

This was another item on Connect that came back saying “Done!”

And again, the team went further.

2010-01-13