Showing posts with label SSIS. Show all posts
Showing posts with label SSIS. Show all posts

Wednesday, January 27, 2010

BUG: SSIS 2008 derived columns from User variables data type

I wanted to create a derived column from a user:variable in SSIS so that I could combine the input of a CSV into a SQL table along with a column name saying where the CSV came from.

Usually you initialise the user:variable before the package starts with a non relevant string, such as "1234" then updated it to the correct value once the process starts.

The problem is that when you use the Derived Coulmn Transformation Editor and add a Derived Column as SSIS fills in the Data Type automatically for you and wont let you change its data length. So if you initialise the user:variable with "1234" the new column will be defined with a Data type Unicode string [DT_WSTR] 4 - notice maximum length of 4!

So if you update the user:variable string to a length of 5 characters SSIS fails!

My work around is to make sure that you initialise the user:variable string with a value which has a length of the maximum possible string which you are likely to encouter.

Hopefully this will be resolved in future releases.

Wednesday, October 14, 2009

Running SSIS packages from a web page

I need to run a simple aspx page on a SQL server to run an SSIS package so that users could kick off the process without having access to the SQL admin tools.

The following C# class in an asp.net page runs brilliantly on the SQL 2008 server

static void CallSSIS()
{
string pkgLocation = @"E:\VS Projects\\Sandbox.dtsx";
Application ssisApp = new Application();
Package ssisPackage = ssisApp.LoadPackage(pkgLocation, null);
DTSExecResult ssisPackageResults = ssisPackage.Execute();
}


The only major problem I had was publishing the web to a virgin Windows 2008 with IIS7 machine. When I browsed to the page it gave the following error "This configuration section cannot be used at this path".

After hours of head scratching and missleading web articles, it turned out that the ASP.NET is not installed as a ROLE in by default.

Server Manager -> Roles -> (scroll to Web Server (IIS)) -> Add Role Services -> ASP.NET

Volia!