Posted on February 27, 2010, 7:18 pm, by Rhys, under
Data,
Powershell.
The London Datastore has loads of datasets available that we can use for free. One of the datasets available is a list of TFL Station Locations. The station location feed is a geo-coded KML feed of most of London Underground, DLR and London Overground stations. Here’s Powershell script that will extract this data from a [...]
Posted on February 24, 2010, 9:45 pm, by Rhys, under
DBA,
Software.
I’m a big fan of Redgate SQL Compare but it’s been good to see the arrival of a few free alternatives. Life previous to these tools really does seem like the stone age now eliminating those "oh $h**, I forgot about that!" moments. I’d always go for Redgate every time but, if you don’t have [...]
Posted on February 21, 2010, 7:51 pm, by Rhys, under
Powershell.
I’m looking at building some Powershell scripts that can accept user input to perform different tasks with a wizard style interface. As it happens this is fairly easily achieved with the Read-Host cmdlet. Here’s a quick script showing how such a powershell script may look. ?View Code POWERSHELLfunction mainMenu() { Clear-Host; Write-Host "============"; Write-Host "= [...]
Posted on February 20, 2010, 7:55 pm, by Rhys, under
SSIS.
A few weeks ago I blogged about my attempts to make dynamic output files in ssis. The idea here was to make an ssis package, producing a text file output, that would cope with complete changes to the data source. If you wanted to add a column all you needed to do was change the [...]
Posted on February 17, 2010, 9:56 pm, by Rhys, under
MySQL,
T-SQL.
There’s few SQL techniques you seem to keep in the cupboard gathering dust. I don’t think I’ve ever needed to use RIGHT JOIN outside of the classroom. I can recall using FULL OUTER JOIN, just once, to show an employer how not-in-sync their "integrated system" was. Today I broke my professional Non-Equi JOIN cherry! I [...]
Posted on February 15, 2010, 9:58 pm, by Rhys, under
SSAS.
One of my goals for this year has been to learn more about SQL Server Analysis Services. So I’ve bought myself a (very fat) book on the subject and have started to work my way through it. A few days ago I built the first example cube in Chapter two. Coming back to it this [...]
Posted on February 14, 2010, 4:58 pm, by Rhys, under
DBA,
MySQL.
Following on from yesterdays blog post, a MySQL clone of sp_MsForEachTable, here’s an attempt at a clone of sp_spaceused. There’s a few issues to be aware of involving the storage engine in use. For example the row count is accurate for MyISAM while with InnoDb it seems to be just an estimate. This estimate can [...]
Posted on February 13, 2010, 7:56 pm, by Rhys, under
DBA,
MySQL.
Many SQL Server DBAs and Developers get a lot of use out of the undocumented sp_MsForEachTable system stored procedure. Here’s an attempt at creating a functional version for MySQL. The procedure makes use of prepared statements, which do have some limitations, so some uses may not translate across. This is far from production ready so [...]
Posted on February 9, 2010, 10:24 pm, by Rhys, under
DBA,
Powershell.
Here’s a Powershell script that can be used to manage index fragmentation in SQL Server databases. The strategy I’ve used in the script is based on a recommendation from Pinal Dave (blog | twitter) in his article Difference Between Index Rebuild and Index Reorganize Explained with T-SQL Script. Just set the $sqlserver and $database variables [...]
Posted on February 6, 2010, 3:35 pm, by Rhys, under
SSIS.
I like making my SSIS packages as dynamic as possible. Once that package has been deployed into production I want to avoid opening it up in BIDS if possible. I’ve blogged previously about using Stored Procedures in Execute SQL Tasks but this only gives us flexibility in terms of the where clause. We have no [...]