Showing posts with label online. Show all posts
Showing posts with label online. Show all posts

Wednesday, March 28, 2012

passing multiple values from parent to child package

Starting with "How to: Use Values of Parent Variables in Child Packages" in the SQL Server 2005 Books Online (http://msdn2.microsoft.com/en-us/library/ms345179.aspx), it seems I need to create a separate package configuration in the child package (of type parent package variable) for each variable I want to pass from the parent to the child. Is that really so? The XML configuration file type allows me to specify any number of variables; how do I do that with the parent package variable?

For that matther, why doesn't the Execute Package Task simply allow me to specify the values of child variables (or other properties) directly? It seems SSIS has made something as trivial as a series of function calls completely opaque:

MyChildPackage(var1=1, var2="foo");

MyChildPackage(var1=2, var2="bar");

MyChildPackage(var1=3, var2="baz");

Kevin Rodgers wrote:

Starting with "How to: Use Values of Parent Variables in Child Packages" in the SQL Server 2005 Books Online (http://msdn2.microsoft.com/en-us/library/ms345179.aspx), it seems I need to create a separate package configuration in the child package (of type parent package variable) for each variable I want to pass from the parent to the child. Is that really so?

Your perception is right.

Kevin Rodgers wrote:

The XML configuration file type allows me to specify any number of variables; how do I do that with the parent package variable?

I may not be understanding you correctly; but I think with either 'parent package variables' or 'XML configuration file' you still need to create an entry in package configuration organizer for every property you want to override; so no difference there. The only difference is that in a XML file, yes you're right, multiple object-properties values can be defined.

Kevin Rodgers wrote:

For that matther, why doesn't the Execute Package Task simply allow me to specify the values of child variables (or other properties) directly? It seems SSIS has made something as trivial as a series of function calls completely opaque:

MyChildPackage(var1=1, var2="foo");

MyChildPackage(var1=2, var2="bar");

MyChildPackage(var1=3, var2="baz");

you mean to make the parent package 'aware' of the variables available in every child package...not sure how good that would be; but you can submit a suggestion to Microsoft:

http://connect.microsoft.com/feedback/default.aspx?SiteID=68

|||

Kevin Rodgers wrote:

Starting with "How to: Use Values of Parent Variables in Child Packages" in the SQL Server 2005 Books Online (http://msdn2.microsoft.com/en-us/library/ms345179.aspx), it seems I need to create a separate package configuration in the child package (of type parent package variable) for each variable I want to pass from the parent to the child. Is that really so? The XML configuration file type allows me to specify any number of variables; how do I do that with the parent package variable?

The XML config file allows you to specify lots of configurations. A configuration is for a single property only.

Kevin Rodgers wrote:

For that matther, why doesn't the Execute Package Task simply allow me to specify the values of child variables (or other properties) directly? It seems SSIS has made something as trivial as a series of function calls completely opaque:

MyChildPackage(var1=1, var2="foo");

MyChildPackage(var1=2, var2="bar");

MyChildPackage(var1=3, var2="baz");

That would mean the parent package needs to have some knowledge of what is in the pckage it is calling. That doesn't really fit with the concept of abstraction - which is what the ability to do parent-child packages is all about really (in my mind anyway). However that isn't a complete justification and I can see why this would be useful - perhaps you should submit the request at Connect?

Hope that helps.

-Jamie

Wednesday, March 21, 2012

Passing ArrayList into Sql Query or any other way around

Hi

I have an arraylist that contains the names of those userid's that i need to check in an online db to check out if they are online now.
If the UserId column of the SqlTable matches any of the name of that of the arraylist, then i need to import the values of two corresponding fields say age, Nick etc.
I would be very grateful to anyone who could kindly tell me how to do this in an Sql Query i.e How to actually send an arraylist into sql query or any other way around this problem.

Say the arraylist to be verified against the table is:
public ArrayList BuddyList = new ArrayList();

Thank You.

Regards.

Check this, it would treat your issue in different way
http://weblogs.asp.net/pleloup/archive/2003/04/14/5569.aspx
HTH

Monday, March 12, 2012

Passing a parameter into a stored procedure in a report ..........

Hi,

I have found this question asked many times online, but the answers always consisted of getting a parameter from the user and to the report. That is NOT what everyone was asking. I would like to know how to pass a parameter I already have into my stored procedure. Using Visual Studio 2005, in the "Data" tab of a report calling something like

Unique_Login_IPs

returns correctly when that stored proc takes no params, but when I have one that takes the year, for example, I do not know how to pass this info in.

Note: the following does not work in this context : EXEC Unique_Login_IPsParameterValue nor does EXEC Some_proc_without_params

Visual studio seems to want only the procedure name because it returns errors that say a procedure with the name "the entire line above like EXEC Unique_Login_IPsParameterValue" does not exist...

Thanks in advance,

Dustin L

Hi,

I am not very clear what you really need to do. What I understand is that you want to pass parameters to stored procedure right?

correct me if I am wrong, else you can do something like :

{

SqlConnection conn = new SqlConnection(DB.Config.Dsn);
conn.Open();
SqlCommand cmd = new SqlCommand("spCRMPublisherSummaryClear", conn);
cmd.CommandTimeout = 3600;
cmd.Parameters.AddWithValue("@.UserName", accountInfo.userName);
cmd.Parameters.AddWithValue("@.FirstName", accountInfo.firstName);
......so on for all your params
cmd.CommandType = CommandType.StoredProcedure;
cmd.ExecuteNonQuery();

}

Hope this helps.

Please dont forget to "Mark as Answer" if this post answers your question.