SSIS package security issue during connection creation - sql

I have create SSIS package for deployment. SSIS package is executed successfully. There are two database servers. 1 server is connected with my package connections and i am deploying on the other server using sql jobs. SQL jobs gives error when try to create connection with other server.
Following is the error.
Date,Source,Severity,Step ID,Server,Job Name,Step Name,Notifications,Message,Duration,Sql Severity,Sql Message ID,Operator Emailed,Operator Net sent,Operator Paged,Retries Attempted
08/26/2013 04:02:19,XIPPackage,Error,0,DEVELOPMENT\PORTFOLIOCENTER,XIPPackage,(Job outcome),,The job failed. The Job was invoked by User test. The last step to run was step 1 (XIPPackageStep).,00:00:00,0,0,,,,0
08/26/2013 04:02:19,XIPPackage,Error,1,DEVELOPMENT\PORTFOLIOCENTER,XIPPackage,XIPPackageStep,,Executed as user: DEVELOPMENT\SYSTEM. Microsoft (R) SQL Server Execute Package Utility Version 10.50.1600.1 for 64-bit Copyright (C) Microsoft Corporation 2010. All rights reserved. Started: 4:02:19 AM Error: 2013-08-26 04:02:19.55 Code: 0xC0202009 Source: TestXIPPackage Connection manager "Source" Description: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80040E4D. An OLE DB record is available. Source: "Microsoft SQL Server Native Client 10.0" Hresult: 0x80040E4D Description: "Login failed for user 'TestCAPITAL\DEVELOPMENT$'.". End Error Error: 2013-08-26 04:02:19.55 Code: 0xC020801C Source: Populate Tradeblotter Staging Load Staging [2633] Description: SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER. The AcquireConnection method call to the connection manager "Source" failed with error code 0xC0202009. There may be error messages posted before this with more information on why the AcquireConnection method call failed. End Error Error: 2013-08-26 04:02:19.55 Code: 0xC0047017 Source: Populate Tradeblotter Staging SSIS.Pipeline Description: component "Load Staging" (2633) failed validation and returned error code 0xC020801C. End Error Error: 2013-08-26 04:02:19.55 Code: 0xC004700C Source: Populate Tradeblotter Staging SSIS.Pipeline Description: One or more component failed validation. End Error Error: 2013-08-26 04:02:19.55 Code: 0xC0024107 Source: Populate Tradeblotter Staging Description: There were errors during task validation. End Error DTExec: The package execution returned DTSER_FAILURE (1). Started: 4:02:19 AM Finished: 4:02:19 AM Elapsed: 0.499 seconds. The package execution failed. The step failed.,00:00:00,0,0,,,,0
08/26/2013 03:49:43,XIPPackage,Error,0,DEVELOPMENT\PORTFOLIOCENTER,XIPPackage,(Job outcome),,The job failed. The Job was invoked by User **hidden**. The last step to run was step 1 (XIPPackageStep).,00:00:00,0,0,,,,0
08/26/2013 03:49:43,XIPPackage,Error,1,DEVELOPMENT\PORTFOLIOCENTER,XIPPackage,XIPPackageStep,,Executed as user: DEVELOPMENT\SYSTEM. Microsoft (R) SQL Server Execute Package Utility Version 10.50.1600.1 for 64-bit Copyright (C) Microsoft Corporation 2010. All rights reserved. Started: 3:49:43 AM Error: 2013-08-26 03:49:43.38 Code: 0xC0016016 Source: Description: Failed to decrypt protected XML node "DTS:Password" with error 0x8009000B "Key not valid for use in specified state.". You may not be authorized to access this information. This error occurs when there is a cryptographic error. Verify that the correct key is available. End Error Error: 2013-08-26 03:49:43.40 Code: 0xC0016016 Source: Description: Failed to decrypt protected XML node "DTS:Password" with error 0x8009000B "Key not valid for use in specified state.". You may not be authorized to access this information. This error occurs when there is a cryptographic error. Verify that the correct key is available. End Error Error: 2013-08-26 03:49:43.82 Code: 0xC0202009 Source: TestXIPPackage Connection manager "Source" Description: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80040E4D. An OLE DB record is available. Source: "Microsoft SQL Server Native Client 10.0" Hresult: 0x80040E4D Description: "Login failed for user 'TEstCAPITAL\DEVELOPMENT$'.". End Error Error: 2013-08-26 03:49:43.82 Code: 0xC020801C Source: Populate Tradeblotter Staging Load Staging [2633] Description: SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER. The AcquireConnection method call to the connection manager "Source" failed with error code 0xC0202009. There may be error messages posted before this with more information on why the AcquireConnection method call failed. End Error Error: 2013-08-26 03:49:43.82 Code: 0xC0047017 Source: Populate Tradeblotter Staging SSIS.Pipeline Description: component "Load Staging" (2633) failed validation and returned error code 0xC020801C. End Error Error: 2013-08-26 03:49:43.82 Code: 0xC004700C Source: Populate Tradeblotter Staging SSIS.Pipeline Description: One or more component failed validation. End Error Error: 2013-08-26 03:49:43.82 Code: 0xC0024107 Source: Populate Tradeblotter Staging Description: There were errors during task validation. End Error DTExec: The package execution returned DTSER_FAILURE (1). Started: 3:49:43 AM Finished: 3:49:43 AM Elapsed: 0.499 seconds. The package execution failed. The step failed.,00:00:00,0,0,,,,0
I have tried with do not save sensitive data but not worked.
Any idea how it can be fixed?

I have tried with do not save sensitive data but not worked.
Please post the error message. You will avoid a lot of hassles if you don't put sensitive data (passwords) in your SSIS packages. You will also avoid hassles if you never write not work and always provide the error message.
With regards to your errors:
Login failed for user 'Test\DEVELOPMENT$'
To fix this you need to add the windows users 'Test\DEVELOPMENT$' as a login to the required database and ensure that it has required access to the database. Alternatively set the SQL Job up to use a windows user that does have access. I can explain further if you wish.
Description: Failed to decrypt protected XML node "DTS:Password"
To avoid this you should:
Only use windows authentication (not SQL Server authentication)
Use 'Do Not Save Sensitive Data' (hence why I need to know the error)

Related

SSIS Package loading data from Excel fails when run as a job

I have created a SSIS Package using Visual Studio 2015 that takes an Excel file and imports it into a database. The job has been running smoothly for weeks, but for some reason, it failed this morning. When I run it as its own package, it runs perfectly but whenever it is in a job, even if it's the only step in the job, it fails. It is running using 32-bit runtime. The error I receive is pasted below.
Executed as user: NA\SQL_INTDB01$. Microsoft (R) SQL Server Execute Package
Utility Version 13.0.1601.5 for 32-bit Copyright (C) 2016 Microsoft. All
rights reserved. Started: 9:41:48 AM Error: 2018-01-04 09:41:49.36
Code: 0xC0202009 Source: STRATImport Connection manager "Excel
Connection Manager" Description: SSIS Error Code DTS_E_OLEDBERROR. An
OLE DB error has occurred. Error code: 0x80004005. An OLE DB record is
available. Source: "Microsoft Access Database Engine" Hresult: 0x80004005
Description: "Failure creating file.". End Error Error: 2018-01-04
09:41:49.36 Code: 0xC020801C Source: Data Flow Task 1 Excel Source
[71] Description: SSIS Error Code
DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER. The AcquireConnection
method call to the connection manager "Excel Connection Manager" failed with
error code 0xC0202009. There may be error messages posted before this with
more information on why the AcquireConnection method call failed. End Error
Error: 2018-01-04 09:41:49.36 Code: 0xC0047017 Source: Data Flow
Task 1 SSIS.Pipeline Description: Excel Source failed validation and
returned error code 0xC020801C. End Error Error: 2018-01-04 09:41:49.36
Code: 0xC004700C Source: Data Flow Task 1 SSIS.Pipeline Description:
One or more component failed validation. End Error Error: 2018-01-04
09:41:49.36 Code: 0xC0024107 Source: Data Flow Task 1
Description: There were errors during task validation. End Error DTExec:
The package execution returned DTSER_FAILURE (1). Started: 9:41:48 AM
Finished: 9:41:49 AM Elapsed: 0.438 seconds. The package execution
failed. The step failed.
Microsoft Access Database Engine has thrown the following error:
Failure creating file
This error is thrown when the Excel connection manager cannot access to the chosen path, it might be caused by:
You are using a network path / try replacing with a local path
it might be pointed to your local server, but when it is deployed to another server it will throw error
you do not have permission to access the selected path from the account that is running the SSIS
path does not exists
References
SSIS Excel File issue - Failure creating file
Failure creating file" error trying to drop and create tables in an Excel data source

SSIS package error in sql server 2012

How to resole this error?
Executed as user: NT Service\SQLSERVERAGENT. Microsoft (R) SQL Server
Execute Package Utility Version 11.0.2100.60 for 64-bit Copyright
(C) Microsoft Corporation. All rights reserved. Started: 10:06:01
AM Error: 2016-08-30 10:06:02.76 Code: 0xC0209303 Source:
Package Connection manager "Excel Connection Manager" Description:
The requested OLE DB provider Microsoft.Jet.OLEDB.4.0 is not
registered. If the 64-bit driver is not installed, run the package in
32-bit mode. Error code: 0x00000000. An OLE DB record is available.
Source: "Microsoft OLE DB Service Components" Hresult: 0x80040154
Description: "Class not registered". End Error Error: 2016-08-30
10:06:02.76 Code: 0xC020801C Source: Data Flow Task Excel
Source [2] Description: SSIS Error Code
DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER. The
AcquireConnection method call to the connection manager "Excel
Connection Manager" failed with error code 0xC0209303. There may be
error messages posted before this with more information on why the
AcquireConnection method call failed. End Error Error: 2016-08-30
10:06:02.76 Code: 0xC0047017 Source: Data Flow Task
SSIS.Pipeline Description: Excel Source failed validation and
returned error code 0xC020801C. End Error Error: 2016-08-30
10:06:02.76 Code: 0xC004700C Source: Data Flow Task
SSIS.Pipeline Description: One or more component failed
validation. End Error Error: 2016-08-30 10:06:02.77 Code:
0xC0024107 Source: Data Flow Task Description: There were
errors during task validation. End Error DTExec: The package
execution returned DTSER_FAILURE (1). Started: 10:06:01 AM
Finished: 10:06:02 AM Elapsed: 1.704 seconds. The package execution
failed. The step failed.
Your trying to us a 64 bit driver when one is not present. You can install the 64 bit driver or assuming you already have the 32 bit driver installed force it to use a 32 bit runtime. Below is a screenshot of an sql agent job where this setting can be found.
Here 64bit driver is not installed, either install
https://www.microsoft.com/en-us/download/details.aspx?id=23734
https://www.microsoft.com/en-us/download/details.aspx?id=13255
or run it on 32 bit in the debug/run settings

Loading Access data to SQL Server

My aim is to update some fields in SQL Server 2008 R2 database from an Access database 2007
I created an ssis package using an Access source which is mapped to network drive, I shared the database
The package executes fine in ssis.
I have to run job for scheduling, and when I run this in SQL Agent job it gets an error shown below
Date,Source,Severity,Step ID,Server,Job Name,Step
Name,Notifications,Message,Duration,Sql Severity,Sql Message
ID,Operator Emailed,Operator Net sent,Operator Paged,Retries Attempted
03/02/2015 12:48:53,test_job,Error,0,PAVAN,test_job,(Job outcome),,The
job failed. The Job was invoked by User PAVAN. The last step to run
was step 1 (testjob_step).,00:00:01,0,0,,,,0
03/02/2015
12:48:53,test_job,Error,1,PAVAN,test_job,testjob_step,,Executed as
user: PAVAN\sys-32. Microsoft (R) SQL Server Execute Package Utility
Version 10.50.1600.1 for 32-bit Copyright (C) Microsoft Corporation
2010. All rights reserved. Started: 12:48:53 PM Error: 2015-03-02 12:48:54.93 Code: 0xC0202009 Source: FirstPackage Connection
manager "\RAGHU-PC\vijay\access db\weighbridge.mdb" Description:
SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error
code: 0x80004005. An OLE DB record is available. Source: "Microsoft
Office Access Database Engine" Hresult: 0x80004005 Description: "The
Microsoft Office Access database engine cannot open or write to the
file '\RAGHU-PC\vijay\access db\weighbridge.mdb'. It is already
opened exclusively by another user or you need permission to view
and write its data.". End Error Error: 2015-03-02 12:48:54.93
Code: 0xC020801C Source: datafor sqlserver OLE DB Source [1]
Description: SSIS Error Code
DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER. The
AcquireConnection method call to the connection manager
"\RAGHU-PC\vijay\access db\weighbridge.mdb" failed with error code
0xC0202009. There may be error messages posted before this with more
information on why the AcquireConnection method call failed. End
Error Error: 2015-03-02 12:48:54.93 Code: 0xC0047017 Source:
datafor sqlserver SSIS.Pipeline Description: component "OLE DB
Source" (1) failed validation and returned error code 0xC020801C. End
Error Error: 2015-03-02 12:48:54.93 Code: 0xC004700C Source:
datafor sqlserver SSIS.Pipeline Description: One or more component
failed validation. End Error Error: 2015-03-02 12:48:54.93 Code:
0xC0024107 Source: datafor sqlserver Description: There were
errors during task validation. End Error DTExec: The package
execution returned DTSER_FAILURE (1). Started: 12:48:53 PM
Finished: 12:48:54 PM Elapsed: 0.936 seconds. The package execution
failed. The step failed.,00:00:01,0,0,,,,0
Along the lines of the above, make sure whoever has Access open did not open it via a shortcut that in the command line has /excl in it, which opens it exclusively and maybe locking this data pump.
Also just for kicks and giggles try running the SSIS package with nobody in it.
Also make sure \RAGHU-PC\vijay\access db\weighbridge.mdb is a valid path on the server where the SSIS package is executed, just it case that is not a correct mapping.

Running a SSIS Package from SQL Server Management Studio 2008

I have set up a Import that copies data from a database on SQLExpress 2005 and Deletes and replaces the Data in a Database on SQL Server Management Studio 2008.
This Runs fine when i set it up for the first time? but if i try to assign a job in SQL Server Management Studio 2008 to run the procedure at a set time it fails?
It also fails if i try to run the stored procedure manually? the only way i can get it too work is to re create from new each time?
Can anyone shed any light on why this may be happening?
The Error message i get ;
Date,Source,Severity,Step ID,Server,Job Name,Step Name,Notifications,Message,Duration,Sql Severity,Sql Message ID,Operator Emailed,Operator Net sent,Operator Paged,Retries Attempted
09/01/2014 15:51:14,PostingJob_Aron,Error,0,RFWSQL,PostingJob_Aron,(Job outcome),,The job failed. The Job was invoked by User sa. The last step to run was step 1 (Import Data).,00:00:18,0,0,,,,0
09/01/2014 15:51:14,PostingJob_Aron,Error,1,RFWSQL,PostingJob_Aron,Import Data,,Executed as user: RFWSQL\SYSTEM. Microsoft (R) SQL Server Execute Package Utility Version 10.50.2500.0 for 32-bit Copyright (C) Microsoft Corporation 2010. All rights reserved. Started: 15:51:15 Error: 2014-09-01 15:51:32.19 Code: 0xC0202009 Source: PostingImportAron Connection manager "SourceConnectionOLEDB" Description: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005. An OLE DB record is available. Source: "Microsoft SQL Server Native Client 10.0" Hresult: 0x80004005 Description: "Login timeout expired". An OLE DB record is available. Source: "Microsoft SQL Server Native Client 10.0" Hresult: 0x80004005 Description: "A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online.". An OLE DB record is available. Source: "Microsoft SQL Server Native Client 10.0" Hresult: 0x80004005 Description: "Named Pipes Provider: Could not open a connection to SQL Server [1326]. ". End Error Error: 2014-09-01 15:51:32.19 Code: 0xC020801C Source: Data Flow Task 1 Source - MyPostings [1] Description: SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER. The AcquireConnection method call to the connection manager "SourceConnectionOLEDB" failed with error code 0xC0202009. There may be error messages posted before this with more information on why the AcquireConnection method call failed. End Error Error: 2014-09-01 15:51:32.20 Code: 0xC0047017 Source: Data Flow Task 1 SSIS.Pipeline Description: component "Source - MyPostings" (1) failed validation and returned error code 0xC020801C. End Error Error: 2014-09-01 15:51:32.20 Code: 0xC004700C Source: Data Flow Task 1 SSIS.Pipeline Description: One or more component failed validation. End Error Error: 2014-09-01 15:51:32.22 Code: 0xC0024107 Source: Data Flow Task 1 Description: There were errors during task validation. End Error DTExec: The package execution returned DTSER_FAILURE (1). Started: 15:51:15 Finished: 15:51:32 Elapsed: 17.14 seconds. The package execution failed. The step failed.,00:00:18,0,0,,,,0
09/01/2014 15:45:59,PostingJob_Aron,Error,0,RFWSQL,PostingJob_Aron,(Job outcome),,The job failed. The Job was invoked by User sa. The last step to run was step 1 (Import Data).,00:00:21,0,0,,,,0
09/01/2014 15:45:59,PostingJob_Aron,Error,1,RFWSQL,PostingJob_Aron,Import Data,,Executed as user: RFWSQL\SYSTEM. Microsoft (R) SQL Server Execute Package Utility Version 10.50.2500.0 for 64-bit Copyright (C) Microsoft Corporation 2010. All rights reserved. Started: 15:45:59 Error: 2014-09-01 15:46:20.59 Code: 0xC0202009 Source: PostingImportAron Connection manager "SourceConnectionOLEDB" Description: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005. An OLE DB record is available. Source: "Microsoft SQL Server Native Client 10.0" Hresult: 0x80004005 Description: "Login timeout expired". An OLE DB record is available. Source: "Microsoft SQL Server Native Client 10.0" Hresult: 0x80004005 Description: "A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online.". An OLE DB record is available. Source: "Microsoft SQL Server Native Client 10.0" Hresult: 0x80004005 Description: "TCP Provider: A connection attempt failed because the connected party did not properly respond after a period of time or established connection failed because connected host has failed to respond. ". End Error Error: 2014-09-01 15:46:20.59 Code: 0xC020801C Source: Data Flow Task 1 Source - MyPostings [1] Description: SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER. The AcquireConnection method call to the connection manager "SourceConnectionOLEDB" failed with error code 0xC0202009. There may be error messages posted before this with more information on why the AcquireConnection method call failed. End Error Error: 2014-09-01 15:46:20.59 Code: 0xC0047017 Source: Data Flow Task 1 SSIS.Pipeline Description: component "Source - MyPostings" (1) failed validation and returned error code 0xC020801C. End Error Error: 2014-09-01 15:46:20.59 Code: 0xC004700C Source: Data Flow Task 1 SSIS.Pipeline Description: One or more component failed validation. End Error Error: 2014-09-01 15:46:20.59 Code: 0xC0024107 Source: Data Flow Task 1 Description: There were errors during task validation. End Error DTExec: The package execution returned DTSER_FAILURE (1). Started: 15:45:59 Finished: 15:46:20 Elapsed: 21.14 seconds. The package execution failed. The step failed.,00:00:21,0,0,,,,0
09/01/2014 15:24:00,PostingJob_Aron,Error,0,RFWSQL,PostingJob_Aron,(Job outcome),,The job failed. The Job was invoked by Schedule 24 (Run). The last step to run was step 1 (Import Data).,00:00:22,0,0,,,,0
09/01/2014 15:24:00,PostingJob_Aron,Error,1,RFWSQL,PostingJob_Aron,Import Data,,Executed as user: RFWSQL\SYSTEM. Microsoft (R) SQL Server Execute Package Utility Version 10.50.2500.0 for 64-bit Copyright (C) Microsoft Corporation 2010. All rights reserved. Started: 15:24:00 Error: 2014-09-01 15:24:21.93 Code: 0xC0202009 Source: PostingImportAron Connection manager "SourceConnectionOLEDB" Description: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005. An OLE DB record is available. Source: "Microsoft SQL Server Native Client 10.0" Hresult: 0x80004005 Description: "Login timeout expired". An OLE DB record is available. Source: "Microsoft SQL Server Native Client 10.0" Hresult: 0x80004005 Description: "A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online.". An OLE DB record is available. Source: "Microsoft SQL Server Native Client 10.0" Hresult: 0x80004005 Description: "TCP Provider: A connection attempt failed because the connected party did not properly respond after a period of time or established connection failed because connected host has failed to respond. ". End Error Error: 2014-09-01 15:24:21.93 Code: 0xC020801C Source: Data Flow Task 1 Source - MyPostings [1] Description: SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER. The AcquireConnection method call to the connection manager "SourceConnectionOLEDB" failed with error code 0xC0202009. There may be error messages posted before this with more information on why the AcquireConnection method call failed. End Error Error: 2014-09-01 15:24:21.93 Code: 0xC0047017 Source: Data Flow Task 1 SSIS.Pipeline Description: component "Source - MyPostings" (1) failed validation and returned error code 0xC020801C. End Error Error: 2014-09-01 15:24:21.93 Code: 0xC004700C Source: Data Flow Task 1 SSIS.Pipeline Description: One or more component failed validation. End Error Error: 2014-09-01 15:24:21.93 Code: 0xC0024107 Source: Data Flow Task 1 Description: There were errors during task validation. End Error DTExec: The package execution returned DTSER_FAILURE (1). Started: 15:24:00 Finished: 15:24:21 Elapsed: 21.156 seconds. The package execution failed. The step failed.,00:00:21,0,0,,,,0
09/01/2014 15:11:00,PostingJob_Aron,Error,0,RFWSQL,PostingJob_Aron,(Job outcome),,The job failed. The Job was invoked by Schedule 24 (Run). The last step to run was step 1 (Import Data).,00:00:00,0,0,,,,0
09/01/2014 15:11:00,PostingJob_Aron,Error,1,RFWSQL,PostingJob_Aron,Import Data,,Executed as user: RFWSQL\SYSTEM. Microsoft (R) SQL Server Execute Package Utility Version 10.50.2500.0 for 64-bit Copyright (C) Microsoft Corporation 2010. All rights reserved. Started: 15:11:00 Error: 2014-09-01 15:11:00.74 Code: 0xC0014060 Source: {7A71992F-6187-4E30-AB94-F6A949E6EC47} Description: Failed to decrypt a package that is encrypted with a user key. You may not be the user who encrypted this package or you are not using the same machine that was used to save the package. End Error Could not load package "\PostingImportARON" because of error 0x8009000B. Description: Key not valid for use in specified state. Source: Started: 15:11:00 Finished: 15:11:00 Elapsed: 0.125 seconds. The package could not be loaded. The step failed.,00:00:00,0,0,,,,0
It is very likely that the table names (destination) are hardcoded to be something. So when run first time, it creates the object.
When you run a second time, that object already exists and therefore fails and exits out at that point in the code - not running your SP as it will be run as a single block or transaction.
What you need is something to check for the existence of the object name wrapped in an IF block so that the remaining logic can be processed.
IF OBJECT_ID('tempdb..#YourSpecificDates') IS NOT NULL
BEGIN
DROP TABLE #YourSpecificDates
/*Do other processes*/
/*Exec your SP*/
END

SSIS Package Failing on Executing Job

Good Day,
I imported a package from SSIS to SQL to run as a Job.
if i manually execute the Package in SSIS in MSSMS it executes successful
as soon as i run it as a job i get the following error:
Executed as user: NT AUTHORITY\LOCAL SERVICE. Microsoft (R) SQL Server
Execute Package Utility Version 10.50.1600.1 for 64-bit Copyright
(C) Microsoft Corporation 2010. All rights reserved. Started:
12:10:22 PM Error: 2014-08-14 12:10:22.07 Code: 0xC0016016
Source: Description: Failed to decrypt protected XML node
"DTS:Password" with error 0x8009000B "Key not valid for use in
specified state.". You may not be authorized to access this
information. This error occurs when there is a cryptographic error.
Verify that the correct key is available. End Error Error:
2014-08-14 12:10:22.24 Code: 0xC0202009 Source:
TritonFuelImport Connection manager "41.160.218.141.CCManager.sa"
Description: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has
occurred. Error code: 0x80040E4D. An OLE DB record is available.
Source: "Microsoft SQL Server Native Client 10.0" Hresult: 0x80040E4D
Description: "Login failed for user 'sa'.". End Error Error:
2014-08-14 12:10:22.24 Code: 0xC020801C Source: Data Flow Task
OLE DB Destination [15] Description: SSIS Error Code
DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER. The
AcquireConnection method call to the connection manager
"41.160.218.141.CCManager.sa" failed with error code 0xC0202009.
There may be error messages posted before this with more information
on why the AcquireConnection method call failed. End Error Error:
2014-08-14 12:10:22.24 Code: 0xC0047017 Source: Data Flow Task
SSIS.Pipeline Description: component "OLE DB Destination" (15)
failed validation and returned error code 0xC020801C. End Error
Error: 2014-08-14 12:10:22.24 Code: 0xC004700C Source: Data
Flow Task SSIS.Pipeline Description: One or more component failed
validation. End Error Error: 2014-08-14 12:10:22.24 Code:
0xC0024107 Source: Data Flow Task Description: There were
errors during task validation. End Error DTExec: The package
execution returned DTSER_FAILURE (1). Started: 12:10:22 PM
Finished: 12:10:22 PM Elapsed: 0.187 seconds. The package execution
failed. The step failed.
Can someone Please assist to help me solve this problem?
When you execute the package from Visual Studio, it is run under your user principal. When it's run through the SQL Agent, it's executed under the account SQL Server is set up with (either Local Service or a domain account set up for this purpose). Now, one part of your package (probably a connection manager) has properties called EncryptSensitive and ProtectionLevel (https://msdn.microsoft.com/en-us/library/ms141747.aspx) and by default this is set to your user account.
When SQL Agent tries to execute, it can't decrypt the sensitive data on the connection manager (probably the password) using its own keys. There are two ways of resolving:
Set the Protection level to something different
Create an SQL Agent Proxy with your credentials and set up the job to use that when executing this package (https://technet.microsoft.com/en-us/library/ms189064(v=sql.105).aspx)
There is a property you need to change in visual studio data tools. Have a look in the properties tab, there is an option for encryption of passwords. There are 3 different options from memory. If that doesn't work, try going to security in SQL server management studio then credentials. Then click add credential and add the credential of the user that successfully runs the job. Then in your job step, go into the step and set "run as" to the credential you created. I would also check the advanced tabs of the job step, to make sure the properties for the username and password are correct, sometimes they don't get deployed from data tools and you have to manually add them to the job step run by the agent.