Showing posts with label ssis. Show all posts
Showing posts with label ssis. Show all posts

Monday, March 19, 2012

Can no longer open my SSIS packages

I am in the process of migrating DTS 2000 packages via DTS Migration Wizard.

I ran all of the packages through the wizard. Then, I successfully completed changing the remaining issues in two of my packages to SSIS. Everything was fine. The second package I completed is called from a SQL Agent Job. I managed to get the job step converted to use SSIS package. It ran successfully.

Now, I am trying to open other packages to work on them and I get "Microsoft Visual Studio is unable to load this document: Value does not fall within the expected range." and a message window that says "Object reference not set to an instance of an object." This actually happens with the two that I migrated, also. I can no longer access them.

What happened?!?!?!? Does anyone have any experience with this?

Well, the solution I had the files in must have been corrupted. I can open individual files using BIDS. I just can't do anything with them from the project. Seems as though a collection might have gone willy.

Sunday, February 19, 2012

Can I set expressions programmatically?

I'm building SSIS packages through code and I would like to set the properties of some custom tasks (not data flow tasks) to expressions. I've done some searches but turned up nothing. This is the only thing I'm hitting a brick wall on at the moment; Books Online has been excellent in detailing how to create packages via code up to this point.

For the sake of argument, let's say I want to set the SqlStatementSource property of an Execute SQL task to this value:

"INSERT INTO [SomeTable] VALUES (NEWID(), '" + @.[User:Tongue TiedomeStringVariable] + "')"

What would the code look like?

TaskHost has a SetExpression method:

TaskHost.SetExpression Method

http://msdn2.microsoft.com/de-de/library/microsoft.sqlserver.dts.runtime.taskhost.setexpression.aspx

I presume all of the other container types (Package, Sequence etc..) will do too.

-Jamie

|||AAAGGGGHHH!! I was expecting a property, not a method! So then in order to retrieve all expressions on a task, you'd have to iterate the Properties collection and call GetExpression() with the name of each one to see if it's non-null. Doesn't seem like a particularly good design to me. Why not a simple collection? Oh well, thanks for the help.|||

JeffJohnsonMVPVB wrote:

AAAGGGGHHH!! I was expecting a property, not a method! So then in order to retrieve all expressions on a task, you'd have to iterate the Properties collection and call GetExpression() with the name of each one to see if it's non-null. Doesn't seem like a particularly good design to me. Why not a simple collection? Oh well, thanks for the help.

Yep. I was expecting a Collection as well.

Maybe a read-only collection would be nice that is populated by SetExpression(). Are there such things as read-only collections? I've no idea - I'm no developer.

I too would be interested in seeing the rationale for this. I hope someone from MSFT chimes in.

Regards

-Jamie

Thursday, February 16, 2012

Can I return a value in a variable from a SSIS program back to C# after the SSIS program is run

Can I return a value in a variable from a SSIS program back to C# after the SSIS program is run from C#?Yes - you can use the variables property of the Package object: http://msdn2.microsoft.com/en-us/library/microsoft.sqlserver.dts.runtime.dtscontainer.variables.aspx

Tuesday, February 14, 2012

Can I read what is in a SSIS variable from within a C# program that executed it?

Can I read what is in a SSIS variable from within a C# program that executed it?Sure, just check the variables collection after execution has finished.
|||

Yes, it was pretty easy. All I needed to do was this.

Variables vars = package.Variables;

int rowcount = Convert.ToInt32(vars["count"].Value);

Friday, February 10, 2012

Can I loop through table and run reports from SSIS

I would like to loop through a SQL Server table that contains the paths to all the reports we need to run and then execute the reports via SSIS. What task should I be doing to do this? Will the For Loop work for something like this?Yes, you can use the ForEach loop to iterate through the resultset of a query.

So you would use an Execute SQL task to select your report URLs and place them in an object variable. You can iterate through those resultset rows in a ForEach ADO Enumerator loop and place values of the columns into variables. Then inside the loop you would use a script task to make a WebRequest to SSRS with a URL you constructed from the variables. You can then write the stream from the WebResponse to a file.

Hopefully you are planning to render these reports to a binary format such as Excel or PDF instead of HTML. HTML reports generally comprise multiple HTTP streams and cannot be easily executed without a browser.
|||

Actually I am running Cognos reports so I would need to build the cmd line command and execute an executable from a command prompt.

Any example of the above on the web?

|||You can run an executable through the Execute Process Task.|||

agentf1 wrote:

Actually I am running Cognos reports so I would need to build the cmd line command and execute an executable from a command prompt.

Any example of the above on the web?

Oh, I shouldn't have assumed SSRS. Running from the command prompt makes it easier. That changes the above so that you'd have another variable that is expression-based to construct your command line, then use an Execute Process instead of script. No code at all.

http://sqljunkies.com/WebLog/knight_reign/archive/2005/03/25/9588.aspx
http://blogs.conchango.com/jamiethomson/archive/2005/07/04/1748.aspx

http://blogs.conchango.com/jamiethomson/archive/2005/03/19/SSIS_3A00_-Evaluating-variables-as-expressions.aspx

|||

Hi JayH

My Name is Praveen . Could you please explain how it could be done in detail . It would be very helpful if send an answer to it .Especially the scripting part i didnt understand anything

|||I would like to loop through a SQL Server table that contains the paths to all the reports we need to run and then execute the reports(SSRS) via SSIS. What task should I be doing to do this? Could you explain in detail

Can I loop through table and run reports from SSIS

I would like to loop through a SQL Server table that contains the paths to all the reports we need to run and then execute the reports via SSIS. What task should I be doing to do this? Will the For Loop work for something like this?Yes, you can use the ForEach loop to iterate through the resultset of a query.

So you would use an Execute SQL task to select your report URLs and place them in an object variable. You can iterate through those resultset rows in a ForEach ADO Enumerator loop and place values of the columns into variables. Then inside the loop you would use a script task to make a WebRequest to SSRS with a URL you constructed from the variables. You can then write the stream from the WebResponse to a file.

Hopefully you are planning to render these reports to a binary format such as Excel or PDF instead of HTML. HTML reports generally comprise multiple HTTP streams and cannot be easily executed without a browser.
|||

Actually I am running Cognos reports so I would need to build the cmd line command and execute an executable from a command prompt.

Any example of the above on the web?

|||You can run an executable through the Execute Process Task.|||

agentf1 wrote:

Actually I am running Cognos reports so I would need to build the cmd line command and execute an executable from a command prompt.

Any example of the above on the web?

Oh, I shouldn't have assumed SSRS. Running from the command prompt makes it easier. That changes the above so that you'd have another variable that is expression-based to construct your command line, then use an Execute Process instead of script. No code at all.

http://sqljunkies.com/WebLog/knight_reign/archive/2005/03/25/9588.aspx
http://blogs.conchango.com/jamiethomson/archive/2005/07/04/1748.aspx

http://blogs.conchango.com/jamiethomson/archive/2005/03/19/SSIS_3A00_-Evaluating-variables-as-expressions.aspx

|||

Hi JayH

My Name is Praveen . Could you please explain how it could be done in detail . It would be very helpful if send an answer to it .Especially the scripting part i didnt understand anything

|||I would like to loop through a SQL Server table that contains the paths to all the reports we need to run and then execute the reports(SSRS) via SSIS. What task should I be doing to do this? Could you explain in detail

Can I load only specific rows of data?

Is there a way to load only specific rows of data into a table in a SSIS package?

I am copying data from 2 separate ingres databases tables that have the same table structure into one SQLServer table using the ADO.NET DataReader Source for ODBC.

Let's say table1 from db1 and table2 from db2 for example.

table1 in db1 contains two rows:

MemberID - 1
Name - Rob

MemberID - 2
Name - James

table2 in db2 contains one row:

MemberID - 1
Name - Rob
MemberID - 2
Name - JAMES

I would like my SSIS job to load all data from table1 in db1 and then only load the data from table2 in db2 where the data in the row is different (as in 'JAMES').

Is there a data flow transformation that can help me do this?

I previously did this in 2000 DTS but had to load the data into 2 separate 'holding' tables and use T-SQL to update the table1 in db1 and was hoping I cuold cut out these steps in SSIS.

I was hoping that SSIS might have some new quick way to do this (lookups maybe?)

Can you help? Thank You

You can use the Lookup transform or the Merge Join transform. T-SQL is still a valid option if it works best for you.

Jamie did a nice comparison here-

Get all from Table A that isn't in Table B
(http://www.sqlis.com/default.aspx?311)|||Thank you

I shall have a read of the article and give it a try