July 16th, 2008
I talked in a previous post about the possibility of using the format command and bulk insert task inside of a foreach loop in order to load all your tables using a single package… I don’t much like the method as it means you have to run each table load in series, and you’re not taking advantage of SSIS (high speed dataflow task, parallelism and eliminating staging with a single pass transformation).

Read the rest of this entry »
Posted in Nuggets, SSIS, SQL Server 2005, Datawarehouse, Methodology | 5 Comments »
June 30th, 2008
A very frequent requirement in a database, especially in an OLTP system is to be able to capture the identity and values of the last inserted record in a table so that we can use it to populate the foreign key in a child table and any other tables that require it.
It is easy enough to capture the last inserted identity if we are only dealing one record at a time using @@IDENTITY, but what happens when we need to do batch inserts? Well, the old way of doing things would mean you had the following options:
- Execute a loop (either a cursor or a WHILE statement), and for each iteration we’d write a record in each of the child tables
- You’d have to select the same data twice, once to insert the audit records and once to update the data
- You’d rely on a trigger to write to the audit table
Well that should now not be necessary as using the OUTPUT clause we can capture all the data we’ve inserted, updated or deleted in a temporary area for use later on, or say in an auditing scenario, we can output the data directly to the auditing table. More importantly we can use that data in a set based transaction instead of row based. The advantages here are obvious.

Read the rest of this entry »
Posted in Nuggets, SQL Server 2005, Performance, T-SQL | No Comments »
May 14th, 2008
Some of the companies I’ve worked for have had reporting contracts with smaller 3rd party providers. Campaign or website analysis provided by them would have to be loaded to the datawarehouse
Security policy dissallowed downloading the files over FTP, because credentials are passed in clear text, and our 3rd party report providers didn’t have a sFTP facility, so in this scenario what other options are available?

Read the rest of this entry »
Posted in Nuggets, SSIS, SQL Server 2005, Datawarehouse, Methodology, Scripting | 2 Comments »
May 12th, 2008
ExecutionInstanceGUID is a system variable of type string. If you are exporting this variable to a package management, custom logging or auditing table ensure that you have the correct mapping in your execute SQL task. It is a string variable and not a GUID (the same applies to other variables whose type may not be the same as the value they represent).

Read the rest of this entry »
Posted in Nuggets, SSIS, SQL Server 2005, Datawarehouse, Methodology | No Comments »
April 4th, 2008
As the SSIS send mail component doesn’t have an option to send html formatted messages, I thought it would help to post some code that implements the system.web.mail namespace.
Considering that sending messages is quite a regular task for any organisation, it might even be worth creating this as a standalone package and calling it each time you need to send a mail. Or even better still, writing a custom component instead.

Read the rest of this entry »
Posted in Nuggets, SSIS, SQL Server 2005, Scripting | 1 Comment »
April 1st, 2008
If you are trying to execute some Jet SQL DDL like CREATE TABLE or DROP TABLE against an Excel workbook and you get this message:
Executing the query “DROP TABLE [Sheet1];” failed with the following error: “Cannot modify the design of table ‘Sheet1′. It is in a read-only database.”.

Read the rest of this entry »
Posted in Nuggets, SSIS, Fixes, SQL Server 2005, Jet 4.0 | 3 Comments »
March 28th, 2008
The order of the configurations used in the development studio is not the same as the order used by DTEXEC, specifically in relation to parent package variables.
Parent Package variables always have the lowest priority no matter what order you set in the configuration manager.
Microsoft have recently added a note to BOL on this subject here
Amazon Link: Microsoft SQL Server 2005 Integration Services
Read the rest of this entry »
Posted in Nuggets, SSIS, SQL Server DBA, SQL Server 2005, Methodology | No Comments »
March 26th, 2008
I recently saw some forum posts on SSC.com asking if there was a way to bulk import DTS 2000 packages into a SQL 2005 database.
The answer is that you can use the DTSBackup utility available for download at www.sqldts.com. Its a lightweight and extremely useful tool that can save hours of mouseclicking, and it works on both SQL 2000 and 2005.
Amazon Link: SQL Server 2000 Developer Edition
Posted in Nuggets, SQL Server DBA, SQL Server 2005, SQL Server 2000 | No Comments »
March 18th, 2008
Normally in SSIS when we want to issue a SQL command against each row in a dataflow, we use the OLE DB Command component. When executed against SQL Server the command normally takes the form:-
UPDATE dbo.TableName SET ColumnName1 = ? WHERE ColumnName2 = ?
Where “?” can be mapped to the incoming columns in the order they are written.
However you will find that when you are using this component against an Access database, that this syntax will not work. You will get an error saying:
There is more than one data source column with the name “?”. The data source column names must be unique.
Amazon Link: Microsoft® Office Access™ 2007 Inside Out (Inside Out (Microsoft))
Read the rest of this entry »
Posted in Nuggets, SSIS, SQL Server 2005, Jet 4.0 | 1 Comment »
March 5th, 2008
Given the problems inherent in loading excel files with SSIS, I thought it might be useful to share with you some code to get you started on interrogating it’s schema prior to running your Execute SQL control tasks or your dataflows.
This is especially useful for me as it allows me to test column names, worksheet names and datatypes etc prior to attempting to load the data (I have found that users have a tendency to format and rename sheets without realising the impact it has on the import). There are other uses too…

Read the rest of this entry »
Posted in Nuggets, SSIS, SQL Server 2005, Methodology, Scripting, Jet 4.0 | No Comments »