sql-job

How can I view full SQL Job History?

天涯浪子 提交于 2021-02-06 07:24:05
问题 In SQL Server Management Studio, when I "View History" for a SQL Job, I'm only shown the last 50 executions of the Job. How can I view a full log of every execution of a SQL Job since it was created on the server? 回答1: The SQL Server Job system limits the total number of job history entries both per job and over the whole system. This information is stored in the MSDB database. Obviously you won't be able to go back and see information that has been since discarded, but you can change the SQL

How can I Schedule a Sql job in Microsoft Azure SQL database?

只愿长相守 提交于 2020-01-09 18:58:27
问题 I have one SQL Agent maintenance job which checks the index fragmentation within a database and rebuilds indexes if required. This is running well in my test server (Microsoft Sql Server 2012). But my production server is in Azure. Now I want to schedule that job to Azure. SQL Agent does not exist in Azure SQL database so how can I schedule a Sql Job in Azure Db? 回答1: Since this question was first asked, there is now another alternative to handle this problem: Azure Functions Here are a

Most efficient way to move table rows from one table to another

Deadly 提交于 2019-12-24 03:37:05
问题 I've created a denormalized table that needs to be inserted/updated every hour. The process is rather involved from a data perspective, so i am looking for a recommend way to update the table without disrupting the users. i am thinking of having a separate table that my process inserts/updates to and once complete, need a way to push those changes to my live production table. any help would be great! 回答1: Another solution is to use multiple schemas and play switch-a-roo. I only prefer this

SQL server job dynamic schedule

让人想犯罪 __ 提交于 2019-12-23 12:28:25
问题 I have a set of SQL server jobs and I want the schedule for them to be dynamic i.e. I want the next run date to come from a table. I have tried updating next_run_date in the sysjobschedules table and next_scheduled_run_date in sysjobactivity table but this doesn't do anything. How would I go about this? 回答1: I think you can use - sp_update_schedule to update the schedule. sp_update_schedule { [ @schedule_id = ] schedule_id | [ @name = ] 'schedule_name' } [ , [ @new_name = ] new_name ] [ , [

Attachment file \\SERVER\file.csv is invalid. [SQLSTATE 42000] (Error 22051). The step failed

柔情痞子 提交于 2019-12-20 04:59:19
问题 I've got 4 SQL servers: SQL Server 2005, SQL Server 2008, SQL Server 2008 R2 and SQL Server 2012. In SQL Server 2008 R2; I have created a SQL job that sends me email every Monday with reports from SQL Server 2005, SQL Server 2008 and SQL Server 2008 R2 on databases that are older than 3 months and it works just fine. But, now that I want to add SQL Server 2012, the job fails with the following error: Executed as user: NT AUTHORITY\SYSTEM. Configuration option 'show advanced options' changed

How to create jobs in SQL Server Express edition

[亡魂溺海] 提交于 2019-12-16 22:12:28
问题 Could anyone please explain to me how to create jobs in SQL Server Express edition? 回答1: SQL Server Express doesn't include SQL Server Agent, so it's not possible to just create SQL Agent jobs. What you can do is: You can create jobs "manually" by creating batch files and SQL script files, and running them via Windows Task Scheduler. For example, you can backup your database with two files like this: backup.bat: sqlcmd -i backup.sql backup.sql: backup database TeamCity to disk = 'c:\backups

Send automated email

这一生的挚爱 提交于 2019-12-13 11:16:14
问题 I want to send automated emails to UserType( requester, assignee ,reviewer,admin) based on an insert and.or update in Database. EX: A remainder email send to requester, assignee ,reviewer and admin if the reviewer is not able to review the data in 7 days from the date it is assigned to him/her. I know I can do this with SQL JOB or with Windows Services. But I ma looking for different way to do this if possible and/or does SSIS provide such functionality? 回答1: I think another option is to

SSIS Package with Dynamically creating Excel destination is not working from SQL Server Jobs

拟墨画扇 提交于 2019-12-13 08:47:02
问题 I'm currently working on a requirement to get data from sql server into Excel destination. I used the exact method from this link " https://sqljunkieshare.com/2012/02/28/how-to-create-and-map-excel-destination-dynamically-in-ssis/ " Except the Dynamical excel sheet name (Doesn't work, so removed the dynamical sheet naming and using a static name for all excel workbook) Condition is : To get a set of distinct ID's from a view and should create an excel sheet for each ID and load the data from