I have 6 ssis packages. All packages are for loading flat files into sql server table. I have created a sql server agent job to automate the flat file load process and put all packes exxecution in different steps. If the first file fails to load into the SQL server table, all the succeeding steps (packages) should not execute. Can I create a transaction to in sql server agent to do this?
Thank you for your help and time.
Change your job step to "Quit the job reporting failure" for the On Failure setting. No need for transactions at all.
Related
The situation is that I have two DB servers with SQL Server, I need to transfer the data from Server A to Server B automatically every night.
So according to sql server data transfer from one server to another server, I created an SSIS project. And it manage to transfer data with good performance. But the question is, how do I export the project into SSIS package and run it every night?
I assume you are still running it from Visual Studio. To schedule it daily you will need to do the below,
Deploy your project to a SQL Server
Create an Agent job and schedule it.
Found a good article, sharing that with you here.
https://www.mssqltips.com/sqlservertutorial/9069/deploy-and-schedule-an-sql-server-integration-services-ssis-package-step-by-step/
You can either store the package as in the file system or in the SSIS catalog. I would say that storing it in the SSIS catalog is the best way to go here.
Before you deploy your package to the SSIS catalog you need to make sure that integration services is installed on your server as well as that the SSIS catalog has been created.
How to create ssis catalog
If all above is OK then proceed and deploy your package and create an agent job. Please notice that you need to set up permissions for the sql agent account so it can access your databases.
I'm thinking of setting up a Local Publication for a database in SQL Server 2017. Is it possbile to generate a Snapshot publication as part of an existing SQL Server Agent Job? There is a schedule when you use the "New publication Wizard" but this generates the snapshot at a specific time. I would need the Snapshot to be generated once one of the steps in an existing job completes successfully.
Is it possbile to generate a Snapshot publication as part of an existing SQL Server Agent Job?
Sure. Just let the wizard create a new agent job, and inspect its job steps. You can then add similar steps to an existing job. Or add a a TSQL job step to your existing job that kicks off the Replication job through sp_start_job.
I'm copying packages from one server to another. When the package is of the type Integration Services Package it's easy to move but when it is T-SQL, I don't know how to move it.
I've moved all packages of the type Integration Services Package now, I'm left with the T-SQL type.
I'm not using a code based method, I'm using the SSIS interface to move the packages over.
I have 15 jobs that use T-SQL within them and no packages. I want to move them all over.
Transfer Job Task
You can use Transfer Job Task to copy SQL agent Job from a server to another one
The Transfer Jobs task transfers one or more SQL Server Agent jobs between instances of SQL Server.
The Transfer Jobs task can be configured to transfer all jobs, or only specified jobs. You can also indicate whether the transferred jobs are enabled at the destination.
Transfer Jobs Task
There are plenty of articles found online, as example:
Transfer SQL Server Jobs Task and Transfer SQL Server Logins Task in SSIS
Generate Scripts via SSMS
You can simply generate SQL scripts and execute them on the other server:
How can I move SQL Server Agent Jobs to different systems?
Is it possible for script to run on its own on sql server when connection closes without sql server agent?
I'd like to start for example long insert script from ETL and have it run through the night without logging into remote server and running that there.
SQL Server Agent is doing the work at the moment but it would be nice to dynamically adjust those scripts in ETL software without having to change job steps in agent.
Hope there is just some obvious trick which hasn't crossed my mind :)
I want to add a database task that runs on a 6 hours interval. The task is to delete some records that matches certain condition.
What is the best way to achieve this in Sql Server 2008 ?
I know I can do this on the app side but I want it on sql server side.
You can use Sql server agent to run a job periodically. The job can do anything you want such as executing stored procedure which will do the actual cleaning.
Set up a task as maintenance task / scheduled task in the SQL Server admin.
There are several options. Two I would suggest:
Set up SQL Agent Job, with a T-SQL step in it. In the step details you will select target database and type in SQL statement to delete rows.
Create SSIS package; use Execute SQL Task and define SQL statement there. Then create SQl Agent Job to call the SSIS package.
(1) has a limitation - it will only be able to run the script against a database locate in the same instance of the SQl Server as SQl Agent, unless you use Linked servers.