Correct me if I am wrong but I believe that we use SQL server agents when we want to carry out automatic jobs.Can jobs be run with out SQL server agents? Thank you!
SQL Agent includes a scheduler, which is convenient for any jobs that need to run unattended.
You can also do that using the Windows Scheduler and the Command Line SQL tool (which comes with SQL Server), but its less "integrated" than using SQL Agent (both in terms of one-stop-shop using e.g. SSMS and logging/checking errors etc.)
Thank you so much Kristen,
I still am not sure if jobs can not be run with out SQL agent. I get the scheduling reoccurring jobs part but I am talking about jobs in general. Can they be run with out SQL agent? Thank you!
no jobs can't be executed without agent. There is no sense executing job without agents because when you create a job its actually contains some sql scripts. You can execute that scripts manually but when you need that scripts will executed without user intervention you need a job. Don't be confuse it is simple as that.
What sort of jobs?
UPDATE MyTable SET StaleFlag = 1 WHERE StaleFlag = 0 AND CreateDate < DATEADD(DAY, -30, GetDate())
that type of thing? You can use Windows Scheduler (say) to launch a BATCH file (or similar) every night, and in the BATCH file you can use SQLCMD (or similar) to fire that SQL script at a specific SQL Server and Database.
SQL Agent allows you to do the exact same thing, but if you don't want to use SQL Agent, or don't have access to it (I don't think it is included in SQL Express, for example) then Windows Scheduler is "just fine" for the job. Just a bit harder work to set it all up ...
actually you can run sql related tasks without SQL server agents. for example you can use a chron job in linux, a scheduled windows task that runs powershell, a scheduled windows task that runs an exe you wrote that is designed to work with sql server.
also I just implemented deployment of automated sql scripts using Jenkins , very powerful tool
sqlcmd -U xx -P xxx -S servername -d databasename -i C:\Subversion\IT\Database\yourapp\sprocs\dbo.sproc_sp.sql -o C:\jenkinslogs\logger.txt