ssis truncate table in ForEach ADO Enumerator - sql

I have been trying to truncate a number of tables in 1 DWH.
after setting my object parameter ,going into the loop
my sql statement is :
truncate table ?
after executing the following error :
[Execute SQL Task] Error: Executing the query "truncate table ?"
failed with the following error: "An error occurred while extracting
the result into a variable of type (DBTYPE_I4)". Possible failure
reasons: Problems with the query, "ResultSet" property not set
correctly, parameters not set correctly, or connection not established
correctly.

Related

Execute SQL task to Insert Date with Parameter

Bypass Set to True and Issue ResolvedI am Using Execute SQL task to Insert Date into Staging Table and I am facing the below error:
[Execute SQL Task] Error: Executing the query
DECLARE #Counter VARCHAR(15)=?
INSERT INTO tblFor..." failed with the following error: "Syntax error, permission violation, or other nonspecific error". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
if you want to manage your variables better use expressions :
and here how to declare your variables from
ones there you can create your variables with type and value if you want

Execute SQL Server stored procedure through SSIS

I have this stored procedure:
CREATE PROCEDURE [dbo].[sp_Carrier_Scan_Compliance]
(#RETAILERID INT OUTPUT,
#SYSTEM_ID VARCHAR(10) OUTPUT)
AS
BEGIN
SET #RETAILERID = 2
SET #SYSTEM_ID = 'DMASOS'
...
END
I have created a SSIS package using a Execute SQL Task in the control flow.
These are my Execute SQL Task editor settings:
This are my Variable settings:
These are my Parameter Mapping settings:
When I run the SSIS package, I get an error:
Error: 0xC002F210 at Execute SQL Stored Procedure (to copy data from 'BI-Datatrunk' source table) Task, Execute SQL Task: Executing the query "exec = [sp_Carrier_Scan_Compliance] ? OUTPUT, ? O..." failed with the following error: "Incorrect syntax near '='.". 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 Stored Procedure (to copy data from 'BI-Datatrunk' source table) Task
Warning: 0x80019002 at Carrier_Scan_Compliance_SP: SSIS Warning Code DTS_W_MAXIMUMERRORCOUNTREACHED. 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.
I am not sure what I am missing.
Please help me.
Thanks
The key part of the last error is
The EXECUTE permission was denied on the object
'sp_Carrier_Scan_Compliance', database 'DATAK', schema 'dbo'."
You need to assign EXECUTE permissions to the SQL user executing the Proc
USE DATAK
GO
GRANT EXECUTE ON sp_Carrier_Scan_Compliance TO <sql user>
GO

Database Maintenance Plan Update Statistics Error

I get an error last night ,I get the following error message:
Executing the query "UPDATE STATISTICS [dbo].[tables] W..." failed
with the following error: "The multi-part identifier "tables.Id" could
not be bound.". Possible failure reasons: Problems with the query,
"ResultSet" property not set correctly, parameters not set correctly,
or connection not established correctly.

SSIS Generic Error for SP Execution

In a for each loop container , for each job reference.
I am running an execute sql task to get a list of 21 INPUT parameters from my stored procedure ( Task 1 ). The INPUT parameters
are then stored in SSIS variables.
Then I have an execute sql task to run the stored procedure, where I set the 21 Input Paramters and an Output parameter. ( Task 2 )
When running the package it fails at Task 2 with the following generic error:
Error: 0xC002F210 at Run sp_insert_Package, Execute SQL Task:
Executing the query "DECLARE #TestFaultStageID int DECLARE #TestID..."
failed with the following error: "Multiple-step OLE DB operation
generated errors. Check each OLE DB status value, if available. No
work was done.". Possible failure reasons: Problems with the query,
"ResultSet" property not set correctly, parameters not set correctly,
or connection not established correctly. Task failed: Run
sp_insert_Fault2 Error: 0xC002F210 at Run sp_insert_Package, Execute
SQL Task: Executing the query "DECLARE #TestFaultStageID int DECLARE
#StoreID..." failed with the following error: "Multiple-step OLE DB
operation generated errors. Check each OLE DB status value, if
available. No work was done.". Possible failure reasons: Problems with
the query, "ResultSet" property not set correctly, parameters not set
correctly, or connection not established correctly. Task failed: Run
sp_insert_Fault2 Warning: 0x80019002 at 02-01-02-Epoch-Jobs-Load: SSIS
Warning Code DTS_W_MAXIMUMERRORCOUNTREACHED. The Execution method
succeeded, but the number of errors raised (2) 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.
I have tried to find the error, by checking all the data types and conversions and other stuff but no luck so far. Is there an easy way to track down or narrow down cause ?
Sql Server 2012
In Execute SQL Task component, in SQLStatement field, you should have question marks (?) set in place where you want to put parameters. They should also be defined in Parameter mapping tab.
Are you sure those are set correctly? Could you share your SQLStatement field value?
Sorted ? missing for the OUTPUT parameter was the problem. Sorry All ! Arghhhh

How to Truncate Multiple Table in SSIS ( using ADO.NET Destination and Oracle Database)

I got a little trouble in SSIS. I have multiple table and i want adding Truncate statement so that table can't create double data.
This is the image of package that I made :
each Data Flow, i used Flat File Source and ADO NET Destination.
And then, in Execute SQL Task i want to apply Truncate Table
After that, i have error message :
"[Execute SQL Task] Error: Executing the query "truncate table Table1
truncate table Tabl..." failed with the following error: "ERROR
[HY000] [Oracle][ODBC][Ora]ORA-00911: invalid character". Possible
failure reasons: Problems with the query, "ResultSet" property not set
correctly, parameters not set correctly, or connection not established
correctly."
What i must suppose to do?
P.S
Sorry if my english is not good
Since the destination is an Oracle Database you should use this syntax:
begin
execute immediate 'truncate table t1';
execute immediate 'truncate table t2';
end;
Does this syntax work:
truncate table table1;
truncate table table2;
Note the semi colons.