Showing posts with label task. Show all posts
Showing posts with label task. Show all posts

Thursday, March 22, 2012

Error in variable mapping in Execute SQL Task

Hi,

I am getting an error message (mentioned below) in the variable mapping of Execute SQL Task in SSIS.

" Error: ForEach Variable Mapping number 9 to variable "User::Value" cannot be applied. "

" Error: The type of the value being assigned to variable "User::Value" differs from the current variable type. Variables may not change type during execution. Variable types are strict, except for variables of type Object. "

Pls anyone have a look and give me a solution asap.

Thanks & Regards,

Prakash Srinivasan.

What was the type of the variable "User::Value" and what the was the value that you were trying to assign to this variable?|||

Hi,

Thanks for your response. I was trying to pass the float value and declared the variable as double only. But yesterday I deleted all the variable mappings and did the same mapping again, the problem got resolved.

I don't know what was the problem, even I re-assigned the same index values (starts with zero) for all the variables in the Foreach ADO Enumerator.

Anyway the problem got solved.

Thanks & Regards,

Prakash Srinivasan.

|||

Hi,

I'm seeing the same problem with one package I have put together. I have an "int" variable from a select statement. That variable is mapped to an int32 variable in the package. When I try and foreach through the data set (from previoeus Execute SQL task), it bombs and I get the same error. Error: ForEach Variable Mapping number 1 to variable "User::variablename" cannot be applied. Then in the PostExecute I get the following error: Error: The type of the value being assigned to variable "User::variablename" differs from the current variable type. Variables may not change type during execution. Variable types are strict, except for variables of type Object.

Seems to me there must be a bug here that only gets triggered when you create the mapping with the incorrect data type, fix it, and then try again. For some reason, even though you have fixed it, it believes the data types are still the old ones. MS, if you are interested in a package that displays this behavior, then email me.

dcb99

|||

All,

Ok. Figured this out for my case. The problem is the foreach will not allow a NULL to be assigned to an int32 variable. Seems like SSIS should have nullable types built into it. Anyway, when I replace the column in my select statement with an ISNULL(columnname, 0) then it works fine. Too bad the error want something like: "Data is out of range for this variable type. Please adjust data or use aa different variable type."

dcb99

Error in variable mapping in Execute SQL Task

Hi,

I am getting an error message (mentioned below) in the variable mapping of Execute SQL Task in SSIS.

" Error: ForEach Variable Mapping number 9 to variable "User::Value" cannot be applied. "

" Error: The type of the value being assigned to variable "User::Value" differs from the current variable type. Variables may not change type during execution. Variable types are strict, except for variables of type Object. "

Pls anyone have a look and give me a solution asap.

Thanks & Regards,

Prakash Srinivasan.

What was the type of the variable "User::Value" and what the was the value that you were trying to assign to this variable?|||

Hi,

Thanks for your response. I was trying to pass the float value and declared the variable as double only. But yesterday I deleted all the variable mappings and did the same mapping again, the problem got resolved.

I don't know what was the problem, even I re-assigned the same index values (starts with zero) for all the variables in the Foreach ADO Enumerator.

Anyway the problem got solved.

Thanks & Regards,

Prakash Srinivasan.

|||

Hi,

I'm seeing the same problem with one package I have put together. I have an "int" variable from a select statement. That variable is mapped to an int32 variable in the package. When I try and foreach through the data set (from previoeus Execute SQL task), it bombs and I get the same error. Error: ForEach Variable Mapping number 1 to variable "User::variablename" cannot be applied. Then in the PostExecute I get the following error: Error: The type of the value being assigned to variable "User::variablename" differs from the current variable type. Variables may not change type during execution. Variable types are strict, except for variables of type Object.

Seems to me there must be a bug here that only gets triggered when you create the mapping with the incorrect data type, fix it, and then try again. For some reason, even though you have fixed it, it believes the data types are still the old ones. MS, if you are interested in a package that displays this behavior, then email me.

dcb99

|||

All,

Ok. Figured this out for my case. The problem is the foreach will not allow a NULL to be assigned to an int32 variable. Seems like SSIS should have nullable types built into it. Anyway, when I replace the column in my select statement with an ISNULL(columnname, 0) then it works fine. Too bad the error want something like: "Data is out of range for this variable type. Please adjust data or use aa different variable type."

dcb99

error in transfer sql task

I am trying to transfer tables from a 2000 database to a 2005 database. I selected only the tables I wanted and when executing the task I get:

Error: 0xC002F363 at Copy Tables, Transfer Sql Server Objects Task: Table "XXX" does not exist at the source.
Task failed: Copy Tables

I have the correct permisions on both (they are both dbo.) and I can create DataFlow tasks for each individual table, however there are about 50-75 tables I need to copy. I tried recreating the package with no luck. Any ideas?

Thanks,
Abe

Try using "Windows Authentication" instead of "SQL Server Authentication" at the destination. I remember seeing a bug (which has been fixed and will be made available in the next SP release).|||I am using windows authentication in the destiantion. I don't have a choice other than using sql authetication at the source though.|||Sorry. The information I gave was not correct.

I did not read your post carefully. I was referring to a different bug related to transfer of objects between two SQL Server 2005 servers.

As far as your problem is concerned, it has been identified as a bug and being handled.

Hopefully the fix will be available soon.

Error in Transfer SQL Server Objects

Hi ,

i am copying objects from one DB to other usign Transfer SQL Server Objects Task. i am getting this error

[Transfer SQL Server Objects Task] Error: Execution failed with the following error: "ERROR : errorCode=-1073548784 description=Executing the query "DROP TABLE [dbo].[testCopy] " failed with the following error: "Cannot drop the table 'dbo.testCopy', because it does not exist or you do not have permission.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.helpFile= helpContext=0 idofInterfaceWithError={8BDFE893-E9D8-4D23-9739-DA807BCDC2AC}".

it is true that object doesnt exist on the destination. but i want it to see if the object is there then drop otherwise just copy the object there,

Regards,

Haroon

This should not happen post SQL 2005 SP1, can you confirm your version?sql

Error in Transfer SQL Server Object Task

Hi all,

I am facing problem while using Transfer SQL Server Object Task in SSIS, it is not importing table & its attributes.

The details settings of Transfer SQL Server Object Task as follows:
clicking edit - Objects(left pane)
Right pane
Connection
Source Connection existing server name 1
Source Database ganny1
Destination Connection existing server name 1
Destination Database ganny2
Destination copy objects
Objects to copy - copy all tables - true
Table Objects
CopyPrimaryKeys - True
CopyForiegnKeys - True

After setting all this configurations, Executing task, I am not able to get table in my destination database.
Please suggest me to solve the issue.

Thanks in advance
Karna

What is the value of CopySchema? If it's false, trying setting it to true.

Monday, March 19, 2012

Error in send mail task

I have a script task in which I check the size of a file.

If the size of a file is greater then 0 KB then I need to send this file as an attachment using send email task.

If size is equal to 0 KB then I don't want to send email at all.

In the script task, I have a flag(@.sFileExists) which i set to true in case of size of file greater then 0 and false in other case.

I am using a precedance constraint (Expression : @.sFileExists=true) and condition is logical AND.

After script task based on the condition (@.sFileExists=true) I am using the send email task for sending the email.

But I am not receiving the email. Please sugest where I am wrong.

Please note that the send email task is working all-right separately.

Do you get any error?
Does the task gets executed at all (when debugging in BIDS - does it turn green)?

Error in send email task

I have a script task in which I check the size of a file.

If the size of a file is greater then 0 KB then I need to send this file as an attachment using send email task.

If size is equal to 0 KB then I don't want to send email at all.

In the script task, I have a flag(@.sFileExists) which i set to true in case of size of file greater then 0 and false in other case.

I am using a precedance constraint (Expression : @.sFileExists=true) and condition is logical AND.

After script task based on the condition (@.sFileExists=true) I am using the send email task for sending the email.

But I am not receiving the email. Please sugest where I am wrong.

Please note that the send email task is working all-right separately.

try ==

so (@.sFileExists==true

|||I tried this, it's not working|||hey its working now, i don't know what was wrong. I deleted the existing send email task and took the new one.

Sunday, March 11, 2012

Error in paramterized query - Execute SQL Task

Hi,

I am having some difficulties with a Execute SQL Task, I'll try to describe:

The task contains 2 queries:

UPDATE config SET last_timestamp_int=this_timestamp_int, this_timestamp_int=CAST(GETDATE() AS INT) WHERE company_id=?

SELECT last_timestamp_int AS last_timestamp_int, this_timestamp_int AS this_timestamp_int FROM config WHERE company_id=?

The ? reference to a variable set in Parameter Mapping, which has a initial string value set. Direction set to "Input", Datatype set to "varchar", and parametername to "0". The connectiontype is OLE DB. I have tried to set BypassPrepare to true, but that doesnt help.

The second query fetch 2 values which is stored in the task's Result Set, in two variables. Resultset is set to single row.

When I press Parse Query, I get an error:

"The query failed to parse. Parameter Information cannot be derived from SQL statements. Set parameter information before preparing command."

When I try to run the package, I get this error:

SSIS package "Package.dtsx" starting.

Error: 0xC002F210 at Store last timestamp in variable, Execute SQL Task: Executing the query "UPDATE config SET last_timestamp_int=this_timestamp_int, this_timestamp_int=CAST(GETDATE() AS INT) WHERE company_id=?

SELECT last_timestamp_int AS last_timestamp_int, this_timestamp_int AS this_timestamp_int FROM config WHERE company_id=?" failed with the following error: "No value given for one or more required parameters.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.

Task failed: Store last timestamp in variable

Warning: 0x80019002 at Define global variables: The Execution method succeeded, but the number of errors raised (1) reached the maximum allowed (1); resulting in failure. This occurs when the number of errors reaches the number specified in MaximumErrorCount. Change the MaximumErrorCount or fix the errors.

Warning: 0x80019002 at Package: The Execution method succeeded, but the number of errors raised (1) reached the maximum allowed (1); resulting in failure. This occurs when the number of errors reaches the number specified in MaximumErrorCount. Change the MaximumErrorCount or fix the errors.

SSIS package "Package.dtsx" finished: Failure.

Can someone please help me identify, what it is I am doing wrong?

Thanks in advance

Your setup looks correct to me, so I have two suggestions for troubleshooting this.

1. Break up the task into two separate tasks, one for the update and a second for the select.

2. Run profiler to see the value and result of your queries when they run.

I don't think there's any issue with the parsing. My understanding is that the parser doesn't know what to do with the ? variable so it always returns an error even if it's a valid working query.

|||Use two parameters, one for the UPDATE and one for the SELECT (even though the values of the parameters are the same)

Error in OLE DB Command task

Hi all,

After applying the SP2 for Korean - we are getting the following error in the above task.

Transfer Fact Data From StagingDB to Presentation DB: Insert Update MetricFact [1021]: An OLE DB error has occurred. Error code: 0x80004005. An OLE DB record is available. Source: "Microsoft OLE DB Provider for SQL Server" Hresult: 0x80004005 Description: "'OPTIMIZE' ? ? ?.".

Not sure what the problem is. The same task was running properly before applying the SP2.

For other language SP2 (on other languages) the same task runs correctly and without any error.

sachin.dubey wrote:

Hi all,

After applying the SP2 for Korean - we are getting the following error in the above task.

Transfer Fact Data From StagingDB to Presentation DB: Insert Update MetricFact [1021]: An OLE DB error has occurred. Error code: 0x80004005. An OLE DB record is available. Source: "Microsoft OLE DB Provider for SQL Server" Hresult: 0x80004005 Description: "'OPTIMIZE' ? ? ?.".

Not sure what the problem is. The same task was running properly before applying the SP2.

For other language SP2 (on other languages) the same task runs correctly and without any error.

Hmmm... strange.

Can you run SQL Server Profiler to see what is getting executed against SQL Server?

-Jamie

|||

I m getting the error at design time also when the Package is opened in BI studio

when i tried using Profiler

it executes exec sp_procedure_params_rowset in backend

and throws following error

???102, ??15, ??1, ????sp_procedure_params_rowset, ?151

'OPTIMIZE' ?????????????.

|||

sachin.dubey wrote:

I m getting the error at design time also when the Package is opened in BI studio

when i tried using Profiler

it executes exec sp_procedure_params_rowset in backend

and throws following error

???102, ??15, ??1, ????sp_procedure_params_rowset, ?151

'OPTIMIZE' ?????????????.

It sounds as though the problem might be outside of SSIS. Try and isolate the problem in SQL Server.

-Jamie

|||

Hmm Thanks Jamie.

I will try there.

Error in OLE DB Command task

Hi all,

After applying the SP2 for Korean - we are getting the following error in the above task.

Transfer Fact Data From StagingDB to Presentation DB: Insert Update MetricFact [1021]: An OLE DB error has occurred. Error code: 0x80004005. An OLE DB record is available. Source: "Microsoft OLE DB Provider for SQL Server" Hresult: 0x80004005 Description: "'OPTIMIZE' ? ? ?.".

Not sure what the problem is. The same task was running properly before applying the SP2.

For other language SP2 (on other languages) the same task runs correctly and without any error.

sachin.dubey wrote:

Hi all,

After applying the SP2 for Korean - we are getting the following error in the above task.

Transfer Fact Data From StagingDB to Presentation DB: Insert Update MetricFact [1021]: An OLE DB error has occurred. Error code: 0x80004005. An OLE DB record is available. Source: "Microsoft OLE DB Provider for SQL Server" Hresult: 0x80004005 Description: "'OPTIMIZE' ? ? ?.".

Not sure what the problem is. The same task was running properly before applying the SP2.

For other language SP2 (on other languages) the same task runs correctly and without any error.

Hmmm... strange.

Can you run SQL Server Profiler to see what is getting executed against SQL Server?

-Jamie

|||

I m getting the error at design time also when the Package is opened in BI studio

when i tried using Profiler

it executes exec sp_procedure_params_rowset in backend

and throws following error

???102, ??15, ??1, ????sp_procedure_params_rowset, ?151

'OPTIMIZE' ?????????????.

|||

sachin.dubey wrote:

I m getting the error at design time also when the Package is opened in BI studio

when i tried using Profiler

it executes exec sp_procedure_params_rowset in backend

and throws following error

???102, ??15, ??1, ????sp_procedure_params_rowset, ?151

'OPTIMIZE' ?????????????.

It sounds as though the problem might be outside of SSIS. Try and isolate the problem in SQL Server.

-Jamie

|||

Hmm Thanks Jamie.

I will try there.

Wednesday, March 7, 2012

Error in File System Task

Hi,

I am trying to transfer all the data from Excel to SQL Server using the Script Task (since I got some issue with the Data Flow -- that is a different story, let us come to this error), and after it got transferred I am deleting the source file using File System Task.

[File System Task] Error: An error occurred with the following error message: "The process cannot access the file 'C:\Prakash\TestFiles\Names.xls' because it is being used by another process."

The problem here is before transfer the data from Excel to SQL Server in the Script Task, the File System Task is getting executed, that is why it says that "it is being used by another process" like that.

I already set the TransactionOption as "Success" only for all the Tasks, but I don't know why the second task is getting executed before the first task completed his job.

If anyone have solution to this, pls let me know in detail ASAP.

Thanks & Regards,

Prakash Srinivasan

Hi All,

Sorry I forgot to close the Excel Connection after the data got transferred. Now I closed it and the problem is solved. But still I have problem with transferring data between Excel and SQL Server using Data Flow Task.

Thanks & Regards,

Prakash Srinivasan

Error in execute sql task

I get the following error when trying to execute an sql statement in oracle and returning the results into an object variable with the execute sql task.

Error: 0xC002F210 at Execute SQL Task, Execute SQL Task: Executing the query "select <columnlist> from <tablename>" failed with the following error: "The SelectCommand property has not been initialized before calling 'Fill'.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.

It executes fine if I select no results or first row but I can't get full result set to work. The query and connection string are valid. Any ideas?

Hi,

Have you selected the "Full Result Set" in the ResultSet option? If so, then create a variable of datatype "Object" and link that variable in the ResultSet tab. In that, enter "0" in the Result Name and in the Variable Name, select the variable you created as Object.

Pls try this and let me know if you have any issues.

Sorry for the delayed response. I just gone thru this issue.

Prakash Srinivasan

|||I have the same issues with the Script task in the control flow. I have the result set to full and assigned to a datatype of object. I also have 0 for the name of the result set but it still give me the same error. " selectcommand was in initialized before Fill" It would be a paid to enter 300 column names in the script component in the data flow side just because this the Script task isnt work. I will be glad if someone could help me.|||

How are you doing this? The Script Task isn't really supposed to be used for extracting SQL data. Why does Execute SQL Task not work for you?

-Jamie

|||

I am pulling data through an ado.net connection connected to a DB/C 4 database (odbc database). I needed to pull data based on the last date run so i need a way to insert a date into my sql command where clause. I am using an expression to set the sqlcommand of the Script task to "select .....from tableA where timestamp > = " @.[datetime::mydate] ". I have the resultset set to Full result set. I also have my resultset variable as Object::rs_data and the name set to 0 for Full resultset. I still get the error so I am think its probably the fact that the script task does not work for ado.net odbc connnections.

|||

I am still left wondering why you are not doing this in an Execute SQL Task. And yet you say "I have the resultset set to Full result set." Are you really using a script task?

-Jamie

|||Sorry, i wasnt paying attention. I meant to say Execute SQL Task instead of Script task. With that said, is there any ideas for fixing the situation and once to assign a resultset to a variable. How do you use that resultset(variable) as datasource in a Data flow.|||Hi,
does anyone have the solution to the error:
The SelectCommand property has not been initialized before calling 'Fill'."
for Execute SQL Task problem? I am also stuck there...
Daren
|||

I'm facing the same problem while I'm extracting data from an "SQL Task" using a result set "full result set".

Also can someone tell me how to read the temp result set created by the SQL task ? The documentation found is very poor for a novice like me and doesn't explain how to read the System.Data.Dataset in order to feed a SQL server destination table.

Thanks

Error in execute sql task

I get the following error when trying to execute an sql statement in oracle and returning the results into an object variable with the execute sql task.

Error: 0xC002F210 at Execute SQL Task, Execute SQL Task: Executing the query "select <columnlist> from <tablename>" failed with the following error: "The SelectCommand property has not been initialized before calling 'Fill'.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.

It executes fine if I select no results or first row but I can't get full result set to work. The query and connection string are valid. Any ideas?

Hi,

Have you selected the "Full Result Set" in the ResultSet option? If so, then create a variable of datatype "Object" and link that variable in the ResultSet tab. In that, enter "0" in the Result Name and in the Variable Name, select the variable you created as Object.

Pls try this and let me know if you have any issues.

Sorry for the delayed response. I just gone thru this issue.

Prakash Srinivasan

|||I have the same issues with the Script task in the control flow. I have the result set to full and assigned to a datatype of object. I also have 0 for the name of the result set but it still give me the same error. " selectcommand was in initialized before Fill" It would be a paid to enter 300 column names in the script component in the data flow side just because this the Script task isnt work. I will be glad if someone could help me.|||

How are you doing this? The Script Task isn't really supposed to be used for extracting SQL data. Why does Execute SQL Task not work for you?

-Jamie

|||

I am pulling data through an ado.net connection connected to a DB/C 4 database (odbc database). I needed to pull data based on the last date run so i need a way to insert a date into my sql command where clause. I am using an expression to set the sqlcommand of the Script task to "select .....from tableA where timestamp > = " @.[datetime::mydate] ". I have the resultset set to Full result set. I also have my resultset variable as Object::rs_data and the name set to 0 for Full resultset. I still get the error so I am think its probably the fact that the script task does not work for ado.net odbc connnections.

|||

I am still left wondering why you are not doing this in an Execute SQL Task. And yet you say "I have the resultset set to Full result set." Are you really using a script task?

-Jamie

|||Sorry, i wasnt paying attention. I meant to say Execute SQL Task instead of Script task. With that said, is there any ideas for fixing the situation and once to assign a resultset to a variable. How do you use that resultset(variable) as datasource in a Data flow.|||Hi,

does anyone have the solution to the error:

The SelectCommand property has not been initialized before calling 'Fill'."

for Execute SQL Task problem? I am also stuck there...

Daren|||

I'm facing the same problem while I'm extracting data from an "SQL Task" using a result set "full result set".

Also can someone tell me how to read the temp result set created by the SQL task ? The documentation found is very poor for a novice like me and doesn't explain how to read the System.Data.Dataset in order to feed a SQL server destination table.

Thanks

Sunday, February 26, 2012

Error in execute sql task

I get the following error when trying to execute an sql statement in oracle and returning the results into an object variable with the execute sql task.

Error: 0xC002F210 at Execute SQL Task, Execute SQL Task: Executing the query "select <columnlist> from <tablename>" failed with the following error: "The SelectCommand property has not been initialized before calling 'Fill'.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.

It executes fine if I select no results or first row but I can't get full result set to work. The query and connection string are valid. Any ideas?

Hi,

Have you selected the "Full Result Set" in the ResultSet option? If so, then create a variable of datatype "Object" and link that variable in the ResultSet tab. In that, enter "0" in the Result Name and in the Variable Name, select the variable you created as Object.

Pls try this and let me know if you have any issues.

Sorry for the delayed response. I just gone thru this issue.

Prakash Srinivasan

|||I have the same issues with the Script task in the control flow. I have the result set to full and assigned to a datatype of object. I also have 0 for the name of the result set but it still give me the same error. " selectcommand was in initialized before Fill" It would be a paid to enter 300 column names in the script component in the data flow side just because this the Script task isnt work. I will be glad if someone could help me.|||

How are you doing this? The Script Task isn't really supposed to be used for extracting SQL data. Why does Execute SQL Task not work for you?

-Jamie

|||

I am pulling data through an ado.net connection connected to a DB/C 4 database (odbc database). I needed to pull data based on the last date run so i need a way to insert a date into my sql command where clause. I am using an expression to set the sqlcommand of the Script task to "select .....from tableA where timestamp > = " @.[datetime::mydate] ". I have the resultset set to Full result set. I also have my resultset variable as Object::rs_data and the name set to 0 for Full resultset. I still get the error so I am think its probably the fact that the script task does not work for ado.net odbc connnections.

|||

I am still left wondering why you are not doing this in an Execute SQL Task. And yet you say "I have the resultset set to Full result set." Are you really using a script task?

-Jamie

|||Sorry, i wasnt paying attention. I meant to say Execute SQL Task instead of Script task. With that said, is there any ideas for fixing the situation and once to assign a resultset to a variable. How do you use that resultset(variable) as datasource in a Data flow.|||Hi,
does anyone have the solution to the error:
The SelectCommand property has not been initialized before calling 'Fill'."
for Execute SQL Task problem? I am also stuck there...
Daren
|||

I'm facing the same problem while I'm extracting data from an "SQL Task" using a result set "full result set".

Also can someone tell me how to read the temp result set created by the SQL task ? The documentation found is very poor for a novice like me and doesn't explain how to read the System.Data.Dataset in order to feed a SQL server destination table.

Thanks

Error in execute sql task

I get the following error when trying to execute an sql statement in oracle and returning the results into an object variable with the execute sql task.

Error: 0xC002F210 at Execute SQL Task, Execute SQL Task: Executing the query "select <columnlist> from <tablename>" failed with the following error: "The SelectCommand property has not been initialized before calling 'Fill'.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.

It executes fine if I select no results or first row but I can't get full result set to work. The query and connection string are valid. Any ideas?

Hi,

Have you selected the "Full Result Set" in the ResultSet option? If so, then create a variable of datatype "Object" and link that variable in the ResultSet tab. In that, enter "0" in the Result Name and in the Variable Name, select the variable you created as Object.

Pls try this and let me know if you have any issues.

Sorry for the delayed response. I just gone thru this issue.

Prakash Srinivasan

|||I have the same issues with the Script task in the control flow. I have the result set to full and assigned to a datatype of object. I also have 0 for the name of the result set but it still give me the same error. " selectcommand was in initialized before Fill" It would be a paid to enter 300 column names in the script component in the data flow side just because this the Script task isnt work. I will be glad if someone could help me.|||

How are you doing this? The Script Task isn't really supposed to be used for extracting SQL data. Why does Execute SQL Task not work for you?

-Jamie

|||

I am pulling data through an ado.net connection connected to a DB/C 4 database (odbc database). I needed to pull data based on the last date run so i need a way to insert a date into my sql command where clause. I am using an expression to set the sqlcommand of the Script task to "select .....from tableA where timestamp > = " @.[datetime::mydate] ". I have the resultset set to Full result set. I also have my resultset variable as Object::rs_data and the name set to 0 for Full resultset. I still get the error so I am think its probably the fact that the script task does not work for ado.net odbc connnections.

|||

I am still left wondering why you are not doing this in an Execute SQL Task. And yet you say "I have the resultset set to Full result set." Are you really using a script task?

-Jamie

|||Sorry, i wasnt paying attention. I meant to say Execute SQL Task instead of Script task. With that said, is there any ideas for fixing the situation and once to assign a resultset to a variable. How do you use that resultset(variable) as datasource in a Data flow.|||Hi,
does anyone have the solution to the error:
The SelectCommand property has not been initialized before calling 'Fill'."
for Execute SQL Task problem? I am also stuck there...
Daren
|||

I'm facing the same problem while I'm extracting data from an "SQL Task" using a result set "full result set".

Also can someone tell me how to read the temp result set created by the SQL task ? The documentation found is very poor for a novice like me and doesn't explain how to read the System.Data.Dataset in order to feed a SQL server destination table.

Thanks

Friday, February 17, 2012

Error if table has not created yet at the first time

Hello,

I have created a package that check if a table exist otherwise it drop it, then it creates a new one (both with SSIS execute SQL task).

Then a Flow task run some transformation SSIS to load the table just created.

The problem is that when I run the package an error occur telling me that the table does not exist (if runs for the first time and in this case the table has not created yet).

How can I run a package that create a table and then Load it.

Thank

You need to set the DelayValidation property to True on the Data Flow and the Execute SQL tasks.

Wednesday, February 15, 2012

Error Handling with Execute Package Task

I have a main package that calls several other packages using Execute Package Tasks. I also have OnPreExecute, OnPostExecute, and OnError event handlers at the package level to audit the beginning and completion of each package. I want to prevent each task from bubbling up to the package event handlers as well as prevent each task from bubbling up to the main package event handlers. I've tried setting the Propagate variable for each of the event handlers to False and setting the DisableEventHandlers property of each task to True but neither solution seems to work. Is there a way to do this that I'm missing?

You have to set [System::Propogate]=false in the eenthandler of the task for which you don't want events to propogate.

Your post doesn't specify on which eventhandlers you are setting this.

-Jamie

|||

I found another thread that describes the problem I'm seeing. Here is the previous thread and, in following the thread, I'm not sure if the conclusion was that this behavior was as designed or that this is really a bug. Here is a link to the previous discussion:

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=57523&SiteID=1

The problem in a nutshell is the following: There are two packages, a parent package which calls a child package using the Execute Package Task. Both packages have OnPostExecute event handlers defined at the package level to log progress with different ExecutionInstanceGUID. Even when the System::Propagate property is set to False for the child package OnPropagate event handler, the parent OnPostExecute event handler is still raised.

I guess the work around is to create an empty event handler for the Execute Package Task in the parent package and set the System::Propagate property for that empty event handler to False to prevent the main package OnPostExecute event from being raised. Since I have several Execute Package Tasks in the real solution, a better approach would be to wrap all the Execute Package Tasks in a Sequence container and create the do nothing event handler with the Propagate property set to false at the Sequence container rather than at each of the Execute Package tasks event handlers.

Does this make sense? Or is there possibly a better solution that I'm missing? Have to confess, I'm getting a bit overwhelmed by the number of possible appoaches one can use to log and audit package execution.

|||

Martin,

I cannot replicate your problem. If I set System::Propogate=FALSE on an eventhandler scoped to the child package then any events raised by the package container of the child package do not propogate to the parent package.

Note that this does NOT stop events raised by containers in the child package from propogating to the parent package. If you want to stop this from happening then set System::Propogate=FALSE on all of those containers as well.

I've also re-read your first post where you say "I want to prevent each task from bubbling up to the package event handlers ". If you only want to capture events fired by the package then you can compare System::PackageID to System::SourceID. If they are different then the event has not been raised by the package.

-Jamie

|||

Jamie,

I guess I was looking at the architecture wrong. I thought the child package was the container for all other containers in the child package and therefore, by setting Propagate to false for all child package event handlers, no events would be raised by any containers in the child package to the parent package. That doesn't seem to be the case. By creating empty event handlers for the Execute Package Task in the parent package and setting Propagate to false for the empty event handlers, events raised by child package containers are not propagated to the parent package event handlers.

We are logging to two tables. Package events in one table and tasks in another table and have created a package template to handle the plumbing. This is great stuff.

|||

Martin Mason wrote:

Jamie,

I guess I was looking at the architecture wrong. I thought the child package was the container for all other containers in the child package and therefore, by setting Propagate to false for all child package event handlers, no events would be raised by any containers in the child package to the parent package. That doesn't seem to be the case.

Yeah, System::Propogate can often be misunderstood - mainly due to the complexity of the container hierarchy. System::Propogate only stops events fired by the container that it is scoped to from propogating. It does not stop events fired by descendant containers from propogating.

Martin Mason wrote:

By creating empty event handlers for the Execute Package Task in the parent package and setting Propagate to false for the empty event handlers, events raised by child package containers are not propagated to the parent package event handlers.

I'm surprised that that is the case though. The package container and the TaskHost container on the Execute Package Task are no different from any other container and should behave the same way.

Martin Mason wrote:

We are logging to two tables. Package events in one table and tasks in another table and have created a package template to handle the plumbing. This is great stuff.

I agree. I'm a big fan of using eventhandlers for custom logging and have advocated it strongly here: http://blogs.conchango.com/jamiethomson/archive/2005/06/11/1593.aspx

-Jamie

|||

Is there an easy way to identify which "System::Propogate" variable goes with what container object? The variable names and scope are all the same? How can you tell which variable goes with which container event. When I define an OnPreExecute event for multiple containers/tasks I can't tell which "System::Propogate" variable goes with what object?

Maybe I am missing something obvious but I do not see the connection?

Thanks!

|||

Each eventhandler has a [System::Propogate] variable scoped to it. Variables called [System::Propogate] are ONLY scoped to eventhandlers, nothing else. Therefore, when you use one there can be no ambiguity about which one you are using, it is the one scoped to the eventhandler you are currently editing.

And remember that an eventhandler is, in turn, scoped to a container in the control-flow.

Does that answer the question?

-Jamie

|||

Um Kind of.

I guess I should have noted that I was referring to the variables list, located under SSIS on the toolbar? Not just when I am editing the event. I understand that when I am editing the event ssis will only show me variables that are in scope to the event/container/task but I was referring to the "ALL" Variable list, where you can view all System and user variables and set their values etc. or add new variables or to view there properties in the properties pane?

Do I make sense?

Thanks!

Error Handling with Execute Package Task

I have a main package that calls several other packages using Execute Package Tasks. I also have OnPreExecute, OnPostExecute, and OnError event handlers at the package level to audit the beginning and completion of each package. I want to prevent each task from bubbling up to the package event handlers as well as prevent each task from bubbling up to the main package event handlers. I've tried setting the Propagate variable for each of the event handlers to False and setting the DisableEventHandlers property of each task to True but neither solution seems to work. Is there a way to do this that I'm missing?

You have to set [System::Propogate]=false in the eenthandler of the task for which you don't want events to propogate.

Your post doesn't specify on which eventhandlers you are setting this.

-Jamie

|||

I found another thread that describes the problem I'm seeing. Here is the previous thread and, in following the thread, I'm not sure if the conclusion was that this behavior was as designed or that this is really a bug. Here is a link to the previous discussion:

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=57523&SiteID=1

The problem in a nutshell is the following: There are two packages, a parent package which calls a child package using the Execute Package Task. Both packages have OnPostExecute event handlers defined at the package level to log progress with different ExecutionInstanceGUID. Even when the System::Propagate property is set to False for the child package OnPropagate event handler, the parent OnPostExecute event handler is still raised.

I guess the work around is to create an empty event handler for the Execute Package Task in the parent package and set the System::Propagate property for that empty event handler to False to prevent the main package OnPostExecute event from being raised. Since I have several Execute Package Tasks in the real solution, a better approach would be to wrap all the Execute Package Tasks in a Sequence container and create the do nothing event handler with the Propagate property set to false at the Sequence container rather than at each of the Execute Package tasks event handlers.

Does this make sense? Or is there possibly a better solution that I'm missing? Have to confess, I'm getting a bit overwhelmed by the number of possible appoaches one can use to log and audit package execution.

|||

Martin,

I cannot replicate your problem. If I set System::Propogate=FALSE on an eventhandler scoped to the child package then any events raised by the package container of the child package do not propogate to the parent package.

Note that this does NOT stop events raised by containers in the child package from propogating to the parent package. If you want to stop this from happening then set System::Propogate=FALSE on all of those containers as well.

I've also re-read your first post where you say "I want to prevent each task from bubbling up to the package event handlers ". If you only want to capture events fired by the package then you can compare System::PackageID to System::SourceID. If they are different then the event has not been raised by the package.

-Jamie

|||

Jamie,

I guess I was looking at the architecture wrong. I thought the child package was the container for all other containers in the child package and therefore, by setting Propagate to false for all child package event handlers, no events would be raised by any containers in the child package to the parent package. That doesn't seem to be the case. By creating empty event handlers for the Execute Package Task in the parent package and setting Propagate to false for the empty event handlers, events raised by child package containers are not propagated to the parent package event handlers.

We are logging to two tables. Package events in one table and tasks in another table and have created a package template to handle the plumbing. This is great stuff.

|||

Martin Mason wrote:

Jamie,

I guess I was looking at the architecture wrong. I thought the child package was the container for all other containers in the child package and therefore, by setting Propagate to false for all child package event handlers, no events would be raised by any containers in the child package to the parent package. That doesn't seem to be the case.

Yeah, System::Propogate can often be misunderstood - mainly due to the complexity of the container hierarchy. System::Propogate only stops events fired by the container that it is scoped to from propogating. It does not stop events fired by descendant containers from propogating.

Martin Mason wrote:

By creating empty event handlers for the Execute Package Task in the parent package and setting Propagate to false for the empty event handlers, events raised by child package containers are not propagated to the parent package event handlers.

I'm surprised that that is the case though. The package container and the TaskHost container on the Execute Package Task are no different from any other container and should behave the same way.

Martin Mason wrote:

We are logging to two tables. Package events in one table and tasks in another table and have created a package template to handle the plumbing. This is great stuff.

I agree. I'm a big fan of using eventhandlers for custom logging and have advocated it strongly here: http://blogs.conchango.com/jamiethomson/archive/2005/06/11/1593.aspx

-Jamie

|||

Is there an easy way to identify which "System::Propogate" variable goes with what container object? The variable names and scope are all the same? How can you tell which variable goes with which container event. When I define an OnPreExecute event for multiple containers/tasks I can't tell which "System::Propogate" variable goes with what object?

Maybe I am missing something obvious but I do not see the connection?

Thanks!

|||

Each eventhandler has a [System::Propogate] variable scoped to it. Variables called [System::Propogate] are ONLY scoped to eventhandlers, nothing else. Therefore, when you use one there can be no ambiguity about which one you are using, it is the one scoped to the eventhandler you are currently editing.

And remember that an eventhandler is, in turn, scoped to a container in the control-flow.

Does that answer the question?

-Jamie

|||

Um Kind of.

I guess I should have noted that I was referring to the variables list, located under SSIS on the toolbar? Not just when I am editing the event. I understand that when I am editing the event ssis will only show me variables that are in scope to the event/container/task but I was referring to the "ALL" Variable list, where you can view all System and user variables and set their values etc. or add new variables or to view there properties in the properties pane?

Do I make sense?

Thanks!

Error Handling not workinh after select a bad table

Hi guys,
I have a SP that is executing a simple task, and I=B4m forcing an error,
but the SQL Server is not catching the error, please help me.
The code is:
insert into table1
select * from table2_bad
print @.@.error
Notes:
The table2_bad is not valid in the database, so the sql show an error
saying that the table isnt create of something... but the variable
@.@.error isnt filled.=20
Do you know why'
Thanks!Answered in .programming. Please do not post the same message independently
to multiple newsgroups.

Error Handling not workinh after select a bad table

Hi guys,
I have a SP that is executing a simple task, and I=B4m forcing an error,
but the SQL Server is not catching the error, please help me.
The code is:
insert into table1
select * from table2_bad
print @.@.error
Notes:
The table2_bad is not valid in the database, so the sql show an error
saying that the table isnt create of something... but the variable
@.@.error isnt filled. Do you know why'
Thanks!Answered in .programming. Please do not post the same message independently
to multiple newsgroups.