sql-job

Permissions for PSExec run from SQL job

半世苍凉 提交于 2019-12-13 08:24:10
问题 I have the following in a CMDExec type SQL Job step (details changed): D:\path\PSExec.exe \\servername -accepteula -u "domain\username" -p password D:\path\executable.exe This works fine. However, I have set up a proxy in SQL Server for the same user account - which the job is using, so you'd think I wouldn't need the -u and -p arguments. But if I don't supply them I get the error: Unhandled Exception: System.Data.SqlClient.SqlException: Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'.

I can execute SSIS on visual studio, but it doesn't in a job of SQL Server 2008

好久不见. 提交于 2019-12-11 14:21:46
问题 I have a simple SSIS package that I made in visual studio, it takes data from an Access data base and pass it to an SQL database. I can execute the package without any problems in Visual Studio 2008 but when I try to implement and execute it on a job in SQL Server 2008 it fails, I get this error message as output: Executed as user: SRV06 \ SYSTEM . Execute Package Utility for Microsoft (R ) SQL Server Version 10.0.1600.22 for 32 -bit Copyright ( C ) Microsoft Corp 1984-2005 . All rights

How do I make a sql job step quit reporting failure

一曲冷凌霜 提交于 2019-12-10 16:45:53
问题 I have a sql job step like this Declare @Result varchar(255) exec myprocedure @Result = @Result output What I want to do: if @Result = 'Error' then mark the job as failed, how can I achieve that? 回答1: Add this to the end of your script: if @Result = 'Error' raiserror('The stored procedure returned an error',16,1) And make sure that on the "Advanced" tab of the step properties, the "on failure action" is set to "Quit the job reporting failure" 回答2: You can use Try Catch Begin Try exec

The SELECT permission was denied on the object 'sysjobs', database 'msdb', schema 'dbo'

自古美人都是妖i 提交于 2019-12-09 13:22:59
问题 I'm getting the following error when trying to read a SQL Job. The SELECT permission was denied on the object 'sysjobs', database 'msdb', schema 'dbo' How can I fix this? 回答1: You need to GRANT the SELECT permission for the user of your job. A simple GRANT . USE pubs GO GRANT SELECT ON authors TO public GO Further information about GRANT 回答2: You use the "SQL Server Agent Fixed Database Roles" in msdb (MSDN link): don't assigned permission directly, it'll be a pain to manage And a "how to"

sql job to run every certain time and execute a console application

匆匆过客 提交于 2019-12-08 04:30:38
问题 I am trying to write a SQL job to run every 10 minutes and to execute a console application that I wrote in C#. It would be really helpful if someone could help. 回答1: What you want is a SQL Server Agent Job, with a CmdExec step (which can execute a windows command line). This is explained here: http://msdn.microsoft.com/en-us/library/ms190264.aspx If security is a concern, it can be secured through the use of a SQL Agent Proxy definition. This is explained here: http://msdn.microsoft.com/en

sql job to run every certain time and execute a console application

扶醉桌前 提交于 2019-12-08 00:23:24
I am trying to write a SQL job to run every 10 minutes and to execute a console application that I wrote in C#. It would be really helpful if someone could help. What you want is a SQL Server Agent Job, with a CmdExec step (which can execute a windows command line). This is explained here: http://msdn.microsoft.com/en-us/library/ms190264.aspx If security is a concern, it can be secured through the use of a SQL Agent Proxy definition. This is explained here: http://msdn.microsoft.com/en-us/library/ms189064(SQL.105).aspx 来源: https://stackoverflow.com/questions/14266561/sql-job-to-run-every

How to run a Job from a Stored Procedure in another server?

纵饮孤独 提交于 2019-12-07 18:04:46
问题 Is it possible to run a Job from a stored procedure located in a different server? If so, how? 回答1: So why not consider using exec LINKEDSERVERNAME.msdb.dbo.sp_start_job 'Job Name' ? (didn't test it though, maybe some-unseen-answer was the same, but erased as incorrect and not working) There must be enough privileges for linked-server-login to run the job, of course - at least it has to be job's owner. 回答2: Yep, you can use the evil that is osql: osql -S "Remote Server" -E -Q"exec msdb.dbo.sp

How to get the value from step1 to step2 in sql Job

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-07 07:22:30
问题 I need to create a SQL JOB. Step1: Insert a Row into TaskToProcess Table and return ProcessID(PK and Identity) Step2: Retrive the ProcessID which is generated in step1 and pass the value to SSIS package and execute the SSIS Package. Is this Possible in SQL server JOB?? Please help me on this Thanks in advance. 回答1: There is no built-in method of passing variable values between job steps. However, there are a couple of workarounds. One option would be to store the value in table at the end of

How to run a Job from a Stored Procedure in another server?

点点圈 提交于 2019-12-06 00:03:05
Is it possible to run a Job from a stored procedure located in a different server? If so, how? So why not consider using exec LINKEDSERVERNAME.msdb.dbo.sp_start_job 'Job Name' ? (didn't test it though, maybe some-unseen-answer was the same, but erased as incorrect and not working) There must be enough privileges for linked-server-login to run the job, of course - at least it has to be job's owner. Yep, you can use the evil that is osql: osql -S "Remote Server" -E -Q"exec msdb.dbo.sp_start_job 'Job Name'" (Where -E denotes using a trusted connection, you can also specify credentials using

How to get the value from step1 to step2 in sql Job

落花浮王杯 提交于 2019-12-05 14:18:24
I need to create a SQL JOB. Step1: Insert a Row into TaskToProcess Table and return ProcessID(PK and Identity) Step2: Retrive the ProcessID which is generated in step1 and pass the value to SSIS package and execute the SSIS Package. Is this Possible in SQL server JOB?? Please help me on this Thanks in advance. There is no built-in method of passing variable values between job steps. However, there are a couple of workarounds. One option would be to store the value in table at the end of step 1 and query it back from the database in step 2. It sounds like you are generating ProcessID by