Archive for the 'Nuggets' Category
Thursday, August 23rd, 2007
From time to time these days I have to put my DBA hat back on and review database schema designed by those whose focus is on application development. What I often find is that attempts to improve performance through indexing have been done in vain as the query optimizer either doesn’t use them enough to merit their creation or they have been created on the wrong columns.
Frequently, optimisation is referred to as a dark art, but here I am going to attempt to give some basic pointers to help enighten the novice database designer…

(more…)
Posted in Nuggets, SQL Server DBA, SQL Server 2005, Datawarehouse, Performance, Microsoft | No Comments »
Tuesday, August 21st, 2007
In my previous post on the pivot component, we created a report from a partially populated translation table.
In this post I’m going to show how we re-import our completed report back to our SQL Server table using the SSIS Unpivot component.

(more…)
Posted in Nuggets, SSIS, SQL Server 2005 | 2 Comments »
Tuesday, August 14th, 2007
The SQL Command OLE DB component doesn’t like inline comments when using the Native SQL Server OLEDBConnection. Leave them in your SQL Code and you get the following error:-
An OLE DB error has occurred. Error code: 0×80004005. An OLE DB record is available. Source: “Microsoft SQL Native Client” Hresult: 0×80004005 Description: “Syntax error, permission violation, or other nonspecific error”.
Take them out and hey presto…
Posted in Nuggets, SSIS | No Comments »
Tuesday, May 22nd, 2007
In my never ending quest to simplify administration tasks on SQL Server, I recently came up with a method to automate the creation of new publications with a one script fits all piece of SQL Code.
Considering that in most enterprises, the default configuration options for replication will remain the same, the only thing that changes are the destination servers and the publications/articles themselves.

(more…)
Posted in Nuggets, SQL Server DBA, Replication, Methodology, T-SQL | No Comments »
Monday, March 5th, 2007
More Excel woes with SSIS…
Be very careful when using Excel as your transformation destination. Given that it is hard to maintain a consistent controlled version of any excel file you are using, it can be very prone to fail on account of the encoding that is used within it.

(more…)
Posted in Nuggets, SSIS, SQL Server 2005 | No Comments »
Wednesday, February 14th, 2007
Remember when you use a Stored Procedure as the OLE DB Source that you need to turn off the ‘x many rows affected’ statement at the end.
Do this by including in the CREATE PROCEDURE script the statement:
SET NOCOUNT ON
Also, ensure that you make the full call to the procedure:
EXEC spStoredProcedure @myString = ?, @myInteger = ?
This makes parameter mapping much easier, however, don’t expect to be able to preview the data… this only seems to work at run-time.
Posted in Nuggets, SSIS, SQL Server 2005 | No Comments »
Tuesday, February 13th, 2007
We try to avoid SQL Server user-defined functions unless we can be certain that there is no other way to achieve what it is we’re asking of them. They aren’t very performant as they calculate on a row by row basis rather than the set based operations that our esteemed RDMS is renowned for.
Having said this I am going to post a table function I created recently for use as part of an SSIS import package that transforms an incoming single row CSV into roughly 100 records each time it runs.
The content team in our organisation faces the soul-destroying task of entering records as well as comma delimited strings on to an Excel spreadsheet which in turn is imported into 2 SQL tables.
There is no straight forward way to split the csv string into a SELECT list, but here is what I have done…
(more…)
Posted in Nuggets, SSIS, SQL Server DBA, SQL Server 2005, T-SQL | 1 Comment »
Thursday, February 1st, 2007
Ever had a multitude of SQL Agent jobs with dependencies on one another in order for your nightly batch to succeed? Ever had a situation where you forgot to set the steps correctly within the job resulting in the batch failing or not even running at all?
Me too… here’s what I did in order to protect myself from human error.
(more…)
Posted in Nuggets, SQL Server DBA, SQL Server 2005, Methodology, T-SQL | No Comments »
Monday, January 29th, 2007
I have just finished the code for a new transactional replication setup.
Requirements were to be able to filter rows according to the destinations that formed part of the fullfilment of the order. This could theoretically include up to 10 destinations however in reality it tended to be 2 or 3. The data would be real-time messages flowing out of the mainframe into the SQL Server via BizTalk.
(more…)
Posted in Nuggets, SQL Server DBA, SQL Server 2005, Replication, Methodology, T-SQL | No Comments »
Monday, January 22nd, 2007
Ever been stuck trying to figure out what people are doing on your server, but unable to tell from DBCC InputBuffer what statements the users are running? This is one of the most useful scripts I’ve come accross and helps enormously when trying to analyse what is happening on your SQL Server.
It is often the case that users will query your database with tools like MS Access or Business Objects which are quite difficult to track. Well this useful tool helps to solve that problem…
(more…)
Posted in Nuggets, SQL Server DBA, SQL Server 2005, Performance, T-SQL | 5 Comments »