Thanks
Guess I couldn't see the tree for the forest. Here is the solution in case anyone else has the issue. Get the NextRunDate property of the Job object in the Microsoft.SqlServer.Management.Smo.Agent namespace.
Thanks
Guess I couldn't see the tree for the forest. Here is the solution in case anyone else has the issue. Get the NextRunDate property of the Job object in the Microsoft.SqlServer.Management.Smo.Agent namespace.
I need to determine when (maybe) and if (definitely) a SQL Agent job will run again. I need to maintain a table of the next pending execution for each job. I need to be able to update this table from within a SQL Agent job, but preferably from within an executing SSIS package in the job. Is this possible and if so, any suggestions on how?
Thanks
Hello, your question is really SQL agent related so you likely want to post in the mgt tools forum but I can say what I know. SQL agent jobs and job steps can be manipulate from TSQL/Stored procedures so in theory you could call those from an SSIS pacakge. For example, using the SSIS Execute SQL task.
The following looks like a good reference to SQL Agent SPs.
http://msdn2.microsoft.com/en-us/library/ms187763.aspx
Hope that helps
|||Here is the solution in case anyone else has the issue. Get the NextRunDate property of the Job object in the Microsoft.SqlServer.Management.Smo.Agent namespace.
There is one token in my Agent Job $WMI(DatabaseName)
Now,I defined this using $(ESCAPE_NONE(WMI(DatabaseName)))
but failed and prompted: Variable WMI(DatabaseName) not found
What should i do for this? thanks
From the updated books online:
For jobs that run in response to WMI alerts, the value of the property specified by property. For example, $(WMI(DatabaseName)) provides the value of the DatabaseName property for the WMI event that caused the alert to run.
So I believe you don't need the ESCAPE_NONE...
|||If do not add ESCAPE_NONE,prompt "For SQL Server 2005 Service Pack 1 or later, all job steps with tokens must be updated with a macro before the job can run"
Discover In SQL Server 2005 SP1, the SQL Server Agent job step token syntax has changed
url:http://support.microsoft.com/kb/915845
I want to do something for each database just was created,So I could not specifiy the value of database, how to deal with that? thanks
|||Perhaps the tokens remain disabled?
Because access to Eventlog is not always secured, the alerts are disabled by default. To get the substitutions to work, you should ensure that only members of trusted groups have write permissions to Eventlog, then enable these tokens on the Agent Properties Dialog Alert System tab, or you can set the AlertReplaceRuntimeTokens reg key.
jkh
There is one token in my Agent Job $WMI(DatabaseName)
Now,I defined this using $(ESCAPE_NONE(WMI(DatabaseName)))
but failed and prompted: Variable WMI(DatabaseName) not found
What should i do for this? thanks
From the updated books online:
For jobs that run in response to WMI alerts, the value of the property specified by property. For example, $(WMI(DatabaseName)) provides the value of the DatabaseName property for the WMI event that caused the alert to run.
So I believe you don't need the ESCAPE_NONE...
|||If do not add ESCAPE_NONE,prompt "For SQL Server 2005 Service Pack 1 or later, all job steps with tokens must be updated with a macro before the job can run"
Discover In SQL Server 2005 SP1, the SQL Server Agent job step token syntax has changed
url:http://support.microsoft.com/kb/915845
I want to do something for each database just was created,So I could not specifiy the value of database, how to deal with that? thanks
|||Perhaps the tokens remain disabled?
Because access to Eventlog is not always secured, the alerts are disabled by default. To get the substitutions to work, you should ensure that only members of trusted groups have write permissions to Eventlog, then enable these tokens on the Agent Properties Dialog Alert System tab, or you can set the AlertReplaceRuntimeTokens reg key.
jkh