Showing posts with label variables. Show all posts
Showing posts with label variables. Show all posts

Wednesday, March 7, 2012

How can i view the value of a variable during debug?

Thats the question... i can see the value of columns adding viewers, but how can i see variables?

Thanks!

Add a break point to one of your control flow tasks (by right clicking on it) and then when debug stops at that break point, you can go up to the Debug menu and select the Locals window to be displayed.|||

Thanks Phil,

I do that, but my variable doesnt appear in the window...

|||

Which window are you looking at? It should be in the Locals window; you have to expand the variables node...

|||

Sorry for my delay rafael, i was on holidays ;-)

I am looking at "Debug/windows/local variables", but nothing appears in this window.

Edit: I finally found the solution, the problem was taht i didnt insert the break point on control flow. Regards.

How can i view the value of a variable during debug?

Thats the question... i can see the value of columns adding viewers, but how can i see variables?

Thanks!

Add a break point to one of your control flow tasks (by right clicking on it) and then when debug stops at that break point, you can go up to the Debug menu and select the Locals window to be displayed.|||

Thanks Phil,

I do that, but my variable doesnt appear in the window...

|||

Which window are you looking at? It should be in the Locals window; you have to expand the variables node...

|||

Sorry for my delay rafael, i was on holidays ;-)

I am looking at "Debug/windows/local variables", but nothing appears in this window.

Edit: I finally found the solution, the problem was taht i didnt insert the break point on control flow. Regards.

How can I use the Variables in SQL Execute SQL task?

I define a package variables "varOutTable" and "varFromTable".

and I insert a SQL Execute SQL Task into Control Flow

my sql command is

"Select * into @.[User::varOutTable] from @.[User::varFromTable]"

but the task failed,

it seems that sql task can't get the varOutTable and varFromTable

How can I use the Variables in SQL Execute SQL task?

thanks!!

Use an expression to build your SQL statement. This is:

Open SQL Task editor|||

thank for your reply.

you are right,

it runs great now.

|||Will this work for a select count(*)?|||

agentf1 wrote:

Will this work for a select count(*)?

Why not? A select count(*) would work just like a select * does.... So yes, it would work.|||Just make sure you add an alias to the column (eg. Count(*) as MyCount) and the result set uses the same name (MyCount)....|||I am doing this, my SQL looks like Select count(*) as recordcount from table_name. My variable is set up in ResultSet on the task and is an object.|||Are there any examples of doing a select count(*) into a variable? For some reason when displaying my variable it looks like it contains -1.|||

agentf1 wrote:

Are there any examples of doing a select count(*) into a variable? For some reason when displaying my variable it looks like it contains -1.

That's because your variable is of OBJECT type. If you're returning one row, one value, you can use an integer data type (in this case).|||I am, thanks. I will try this.|||When changed to int32 I get the following error message.

Error: 0xC001F009 at D3OLNAC3: The type of the value being assigned to variable "User::spmessage" differs from the current variable type. Variables may not change type during execution. Variable types are strict, except for variables of type Object.
Error: 0xC002F210 at Execute SQL Task, Execute SQL Task: Executing the query "select count(*) as recordcount from loan_auj" failed with the following error: "The type of the value being assigned to variable "User::spmessage" differs from the current variable type. Variables may not change type during execution. Variable types are strict, except for variables of type Object.
". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
Task failed: Execute SQL Task
Warning: 0x80019002 at D3OLNAC3: The Execution method succeeded, but the number of errors raised (3) 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 "D3OLNAC3.dtsx" finished: Failure.|||

That should work. Make sure ResultSet property is set to single row; the result set page you have a resultsetname RecordCount that points to a SSIS variable and that variable is Int32.

If all this is fine; then post all the details of you Execute SQL task to see other potential causes of error

|||That was it, I needed to change result set to single row. Thanks.

How can I use the Variables in SQL Execute SQL task?

I define a package variables "varOutTable" and "varFromTable".

and I insert a SQL Execute SQL Task into Control Flow

my sql command is

"Select * into @.[User::varOutTable] from @.[User::varFromTable]"

but the task failed,

it seems that sql task can't get the varOutTable and varFromTable

How can I use the Variables in SQL Execute SQL task?

thanks!!

Use an expression to build your SQL statement. This is:

Open SQL Task editor|||

thank for your reply.

you are right,

it runs great now.

|||Will this work for a select count(*)?|||

agentf1 wrote:

Will this work for a select count(*)?

Why not? A select count(*) would work just like a select * does.... So yes, it would work.|||Just make sure you add an alias to the column (eg. Count(*) as MyCount) and the result set uses the same name (MyCount)....|||I am doing this, my SQL looks like Select count(*) as recordcount from table_name. My variable is set up in ResultSet on the task and is an object.|||Are there any examples of doing a select count(*) into a variable? For some reason when displaying my variable it looks like it contains -1.|||

agentf1 wrote:

Are there any examples of doing a select count(*) into a variable? For some reason when displaying my variable it looks like it contains -1.

That's because your variable is of OBJECT type. If you're returning one row, one value, you can use an integer data type (in this case).|||I am, thanks. I will try this.|||When changed to int32 I get the following error message.

Error: 0xC001F009 at D3OLNAC3: The type of the value being assigned to variable "User::spmessage" differs from the current variable type. Variables may not change type during execution. Variable types are strict, except for variables of type Object.
Error: 0xC002F210 at Execute SQL Task, Execute SQL Task: Executing the query "select count(*) as recordcount from loan_auj" failed with the following error: "The type of the value being assigned to variable "User::spmessage" differs from the current variable type. Variables may not change type during execution. Variable types are strict, except for variables of type Object.
". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
Task failed: Execute SQL Task
Warning: 0x80019002 at D3OLNAC3: The Execution method succeeded, but the number of errors raised (3) 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 "D3OLNAC3.dtsx" finished: Failure.|||

That should work. Make sure ResultSet property is set to single row; the result set page you have a resultsetname RecordCount that points to a SSIS variable and that variable is Int32.

If all this is fine; then post all the details of you Execute SQL task to see other potential causes of error

|||That was it, I needed to change result set to single row. Thanks.