CREATE PROCEDURE [dbo].[CreateTask]
@ScheduleID uniqueidentifier,
@Name nvarchar (260),
@StartDate datetime,
@Flags int,
@NextRunTime datetime = NULL,
@LastRunTime datetime = NULL,
@EndDate datetime = NULL,
@RecurrenceType int = NULL,
@MinutesInterval int = NULL,
@DaysInterval int = NULL,
@WeeksInterval int = NULL,
@DaysOfWeek int = NULL,
@DaysOfMonth int = NULL,
@Month int = NULL,
@MonthlyWeek int = NULL,
@State int = NULL,
@LastRunStatus nvarchar (260) = NULL,
@ScheduledRunTimeout int = NULL,
@UserSid varbinary (85) = null,
@UserName nvarchar(260),
@AuthType int,
@EventType nvarchar (260),
@EventData nvarchar (260),
@Type int ,
@Path nvarchar (425) = NULL
AS
DECLARE @UserID uniqueidentifier
EXEC GetUserID @UserSid, @UserName, @AuthType, @UserID OUTPUT
Insert into Schedule
(
[ScheduleID],
[Name],
[StartDate],
[Flags],
[NextRunTime],
[LastRunTime],
[EndDate],
[RecurrenceType],
[MinutesInterval],
[DaysInterval],
[WeeksInterval],
[DaysOfWeek],
[DaysOfMonth],
[Month],
[MonthlyWeek],
[State],
[LastRunStatus],
[ScheduledRunTimeout],
[CreatedById],
[EventType],
[EventData],
[Type],
[Path]
)
values
(@ScheduleID, @Name, @StartDate, @Flags, @NextRunTime, @LastRunTime, @EndDate, @RecurrenceType, @MinutesInterval,
@DaysInterval, @WeeksInterval, @DaysOfWeek, @DaysOfMonth, @Month, @MonthlyWeek, @State, @LastRunStatus,
@ScheduledRunTimeout, @UserID, @EventType, @EventData, @Type, @Path)
GO
GRANT EXECUTE ON [dbo].[CreateTask] TO [RSExecRole]
GO