How to schdule my job on 16th working day of the every month?

hi frnz
I have a big task in my end, i have created one  package ,i want to execute that every month of 16th working day i want to run my job with schdule,how should i schdule my job using
SQL AGENT IN SQL SERVER
Can some one please help me out .......
Thanks

To add to Visakh's response, another method is to add the T-SQL script as the first job step to identify non-run days and raise an error when the job is not to be run.  Set this first job step on failure action to "Quit the job reporting success".
Personally, I would use a full calendar table with an indicator of whether a given date is a working day or not.  I thing you will find such a table useful beyond this scheduling requirement.  For example:
CREATE TABLE dbo.Calendar(
CalendarDate date NOT NULL
CONSTRAINT PK_Calendar PRIMARY KEY CLUSTERED
,CalendarYear int NOT NULL
,CalendarMonth int NOT NULL
,CalendarDay int NOT NULL
,BusinessDay bit NOT NULL
See
http://weblogs.sqlteam.com/dang/archive/2010/07/19/calendar-table-and-datetime-functions.aspx for an example of a more extensive calendar table along with a script to load US holidays.  The code below shows one method to use it for your scheduling
requirement:
DECLARE @RunDay bit = 0;
WITH this_month_business_days AS (
SELECT
CalendarDate
,ROW_NUMBER() OVER(ORDER BY CalendarDate) AS BusinessDayNumber
FROM dbo.Calendar AS c
WHERE
CalendarYear = DATEPART(year, GETDATE())
AND CalendarMonth = DATEPART(month, GETDATE())
AND BusinessDay = 1)
SELECT @RunDay = 1
FROM this_month_business_days
WHERE
BusinessDayNumber = 16
AND CalendarDate = CAST(GETDATE() AS date);
IF @RunDay = 0
BEGIN
RAISERROR ('Today is not a run day', 16, 0)
END;
Dan Guzman, SQL Server MVP, http://www.dbdelta.com

Similar Messages

  • To get the list of working days-3 to working days+10 of every month

    Hi,
    I am looking for a query,which will give me the list of working days in a column (except Saturday and Sunday)ranging from
    [Working day- 3] to [Working day +10]of each month from (April 2014 ) till 2016 December.Could you please help me in achiving it.
    Note :Working day -3 means ,When the first working day of a month is [ 1st April ,Monday].
    So it has to result as March 27,28 and 29 as my last working days.
    Same logic applies for Working day +10(it needs to give total 10 dates,which excludes Saturday and Sunday)
    Regards,
    Ramesh

    DECLARE @monthDate datetime
    SET @MonthDate = '20140401'
    SELECT [Date]
    FROM
    SELECT [Date],ROW_NUMBER() OVER (PARTITION BY DATEDIFF(mm,0,[Date]) ORDER BY [Date]) AS Seq,
    ROW_NUMBER() OVER (PARTITION BY DATEDIFF(mm,0,[Date]) ORDER BY [Date] DESC) AS BSeq
    FROM dbo.CalendarTable(DATEADD(dd,- 10,@MonthDate),DATEADD(yy,2,@MonthDate),1,0)
    )t
    WHERE (Seq BETWEEN 2 AND 11 AND [DATE] > @MonthDate)
    OR BSeq BETWEEN 1 AND 3
    ORDER BY [Date]
    CalendarTable can be found here
    http://visakhm.blogspot.in/2010/02/generating-calendar-table.html
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • How do I change my default "SAP Working Directory" to the one I wish ?

    Hello Gurus,
    How do I change my default "SAP Working Directory" to the one I wish ?
    At the moment default SAP Working Directory to set to the following directory.
    "C:\Documents and Settings\T51273\SapWorkDir"
    So, when ever I try to download a Report/Table Contents/Spool Request, SAP prompts me to save in the above SAP Working Directory, which is "C:\Documents and Settings\T51273\SapWorkDir". Ofcourse I can change the folder in the dialogue box, but I don't want to change the folder each and every time I download a report from SAP.
    I wish to change my default "SAP Working Directory" to "My Documents" Folder. So that from next time,
    if ever I try to download a Report/Table Contents/Spool Request, SAP should prompt "My Documents" Folder. That way I don't have to change the folder at the time of saving.
    Full Points are assigned for an answer that works...
    Thank You,
    Nag.

    Hello,
    A short question about transaction SO21:
    Is this a local setting, per GUI?
    Or does this affect all users?
    I have a problem opening an attachment (Mandates).
    SAP wants to save it to C:\Windows\System32\
    I see that is stated at SO21.
    If I change that to another (accessable) location, does that affect the opening of the attachment?
    Thanks!

  • I have been dragging my files to a external drive to have a back-up for them and I lost some of my folders. They just went completely missing. I didn't delete them, and it was all stuff that I have worked on in the past month. How do I get them back?

    I have been dragging my files to a external drive to have a back-up for them and I lost some of my folders. They just went completely missing. I didn't delete them, and it was all stuff that I have worked on in the past month. How do I get them back?

    You really should be doing backups with an actual backup application, especially one that will work automatically, and, if your external HD is large enough, back up your entire system.  These can automatically back up only what's changed since the  previous backup, and some will keep "archive" copies of things you've changed or deleted, also.
    Too many things can go wrong, such as your internal HD failing, and you'll have a major project to reinstall everything.
    You already have Time Machine, built-in to OSX.  You might want to review the Time Machine Tutorial, and perhaps browse Time Machine - Frequently Asked Questions.
    #27 in the second link mentions some alternatives, too.

  • HT1338 How can I get my photo to work again? the app will not open on my desk top any more. I can not dave my photo on my desk top

    How can I get my photo to work again? the app will not open on my desk top any more. I can not dave my photo on my desk top

    Hello, Cubby21. 
    Thank you for using Apple Support Communities.
    Here are the best resources for troubleshooting issues with Message.
    iOS: Troubleshooting FaceTime and iMessage activation
    http://support.apple.com/kb/ts4268
    iOS: Troubleshooting Messages
    http://support.apple.com/kb/TS2755
    Cheers,
    Jason H.

  • How can i get a number of working days in a month PL/SQL

    How can i get a number of working days in a month(excluding Saturday and Sunday) in a query in PL/SQL ?

    Please do a search before posting
    sql>
    select count(*)
    from(
    select trunc(sysdate,'month')+rownum-1 dy
    from all_objects
    where rownum <= last_day(sysdate) - trunc(sysdate,'month')+1)
    where to_char(dy,'fmday') not in ('sunday','saturday');
    COUNT(*) 
    23
    Message was edited by:
            jeneesh
    Please try yourself to change the query to one that doesn't use a subquery..                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • How to create a recurrent event on the first or last work day of the month

    The lightning calendar allows selection of the first and last day of the month for recurrent events but for business I need to use the first and last WORK day of the month (Monday - Friday) to schedule particular tasks. In the calendar preferences under 'View' I can select the days that make up the work week but this does not transfer to an option in recurrent events. Is there another way to do this or is it just not available?

    Hi there,
    do know for the UlltimateBootCD4Win? This from CD bootable WinXP-BartPEedition with additional tools gives you the ability to make such things like partitioning, backup or formatting your HDD.
    It has many more applications which help you to maintain your system without booting your original OS.
    So I think that this CD will solve your partitioning issues.
    Heres a link: www.ubcd4win.com/
    Just try it and tell me your opinion.
    Nice weekend and greetings from the sunny south ;)

  • How to get the last day of the previous month

    Hello Team,
    If  my input date is today , then i need to find out the last day of the previous month for the same.
    Can someone help me  to find out .. how can this be done.
    Regards,
    Ravi

    Hi,
    Try the below code.
         // get a calendar object
        GregorianCalendar calendar = new GregorianCalendar();
        // convert the year and month to integers
        int yearInt = Integer.parseInt(year);
        int monthInt = Integer.parseInt(month);
         int dayInt = Integer.parseInt(day);
        // adjust the month for a zero based index
        monthInt = monthInt - 1;
        // set the date of the calendar to the date provided
        calendar.set(yearInt, monthInt, dayInt);
        int day = calendar.getActualMaximum(GregorianCalendar.DAY_OF_MONTH);
        return Integer.toString(day);
    Regards
    Venkat

  • Weekly schedule line should pass to last working day of the week in SAg

    HI,
    In a scheduling agreement when we have weekly or monthly schedules the system displays the date in the screen as 12/2010 or 13/2010 for say a weekly schedule.
    However when the data is stored in the table the delivery date is always the first working day of the week. In this case when the week is 13/2010 the data is stored in the table as 22/03/2010.
    Is there any way to change this to the last working day of the week?
    We have some config related to define delivery intervals in IMG--> Sales and Distribution --> Sales --> Sales Documents --> Scheduling Agreements with Delivery Schedules --> Define Delivery Intervals. Will this help solve my issue? If it solves what is the procedure behind this?
    Request you to provide your inputs.
    Thank You, Lakshmikanth

    Hi,
    Seems the delivery split concept is different from this requirement. Can Delivery intervals concept help us or not? IMG--> Slaes and Distribution --> Sales --> Sales Documents --> Scheduling Agreements with Delivery Schedules --> Control EDI Inbound Processing --> Define Delivery Intervals.
    What is the procedure and assignment details for delivery intervals concept?
    Thanks, Lakshmikanth

  • Need working days for a particular month and year

    Hi,
    I need the number of working days for a particular month and year.Saturdays and Sundays are holidays.
    Regards,
    Vignesh

    Try this:
    SQL> var yr NUMBER;
    SQL> exec :yr := 2010;
    PL/SQL procedure successfully completed.
    SQL> with t as (select :yr yr from dual)
      2  SELECT TO_CHAR(dat,'MON-RR'),COUNT(*) FROM
      3  (select TO_DATE('01-JAN-'||yr) + lv dat FROM
      4  (select level - 1 lv,yr from t
      5  connect by level <= TO_DATE('31-DEC-'||yr) - TO_DATE('01-JAN-'||yr) + 1))
      6  WHERE TO_CHAR(Dat,'DY') NOT IN ('SAT','SUN')
      7  GROUP BY TO_CHAR(dat,'MON-RR');
    TO_CHAR(DAT,   COUNT(*)
    APR-10               22
    AUG-10               22
    DEC-10               23
    FEB-10               20
    JAN-10               21
    JUL-10               22
    JUN-10               22
    MAR-10               23
    MAY-10               21
    NOV-10               22
    OCT-10               21
    TO_CHAR(DAT,   COUNT(*)
    SEP-10               22
    12 rows selected.
    SQL> Edited by: AP on Jul 27, 2010 7:54 AM

  • How  to  get the FIRST DAY OF THE CURRENT MONTH

    how to get the FIRST DAY OF THE CURRENT MONTH in oracle 9i.
    plzzzzz send immedaily.advance thanks

    TEST@test SQL> select trunc(sysdate,'MON') from dual;
    TRUNC(SYS
    01-OCT-06
    TEST@test SQL>                                  

  • FM to determine working days of the Org Unit

    Is there a function module to retrieve the number of working days when the org is valid? Thanks!

    Hi,
    The day is always going to be the same '01'; only the month and year are goint to change..
    w_date+6(2) = '01'.
    IF w_date+4(2) = '12'.
    w_date+4(2) = '01'.
    w_date(4) = w_date(4) + 1.
    ELSE.
    w_date4(2) = w_date4(2) + 1.
    ENDIF.
    Thanks and Best Regards,
    Vikas Bittera.

  • Calculate the working days having the start and end dates only

    Hi,
    Can BIP be able to calculate the working days having the start and end dates only? It is like the NETWORKDAYS function in Excel. (i.e. excluding weekends and holidays).
    Thanks.

    Not out of the box.
    But You could extend your BIP functions
    Look at here:
    http://blogs.oracle.com/xmlpublisher/2009/05/bip_by_extension.html
    Based on that what you need is similar to the following Java code:
    http://objectlabkit.sourceforge.net/
    regards
    Jorge A.

  • Editing Working Days/Non Working Days in the base Project Calendar PWA

    Hello Experts,
    I am attempting to edit working days/non working days in the base project calendar PWA 13. I receive an error message when I attempt to open the base project schedule.
    I click the "edit" button under "Enterprise Calendars" page.  The error message states:
    "This Project Web App feature requires at least Microsoft Internet Explorer 8.0"  (using Chrome)
    Attempting to Opening PWA in I.E. I receive a different error message stating that I need Project Professional installed on my computer and it cannot find the current project.  
    I have Admin rights, I have project pro, and Im able to access any project or function using PWA and Project Pro. Can you tell me what I am missing (detailed steps--kinda new to PWA)
    Thanks so much.  

    If you allow me to jump in, I'd advice you to first open MS Project Pro and then try again.
    Also check that your MS Project Pro URL account do not finish with /default.aspx.
    Finally ensure that your PWA URL is in the trusted site and eventually add it to the compatibility sites.
    Hope this helps,
    Guillaume Rouyre, MBA, MVP, P-Seller |

  • Job trigger on a fix date of every month

    Hi All,
    for program SAPF080R, we want to triger a job where reversal posting date is 5th of every month. So we want to schedule this job on monthly basis where reversal posting date field get value as 5th of every month.
    Please suggest how we can do this.
    Regards
    Deepak

    Hi Eli,
    our case is that all document posted in a particular month get a reversal posting date as 5th of next month.
    Now in field "reversal posting date", we need date which should get changed as 5th of every month.
    for  example, in may month, it should be 05/05/2014, then in june, it should be 05/06/2014.
    Please suggest if there is way to schedule where reversal posting date get changed automatically in above way.

Maybe you are looking for

  • Build issue on Solaris

    Hi, I have developed a webservice using WL 8.1.2 workshop. It builds fine on the Windows environmnt. I use the WlWBuildtask. But, when I try the same on a Solaris box, I get the following error: [Build] webservice/XXX.jws:56:ERROR:Package XXX.XXX con

  • Creting flat file

    HI ALL, When creating flat file..in Excel sheet i have macintosh.csv,microsoft.csv and limited text.csv..which one i should select and save the falt file? Vijayalakshmi.Y

  • Multiple DADs on single OAS

    Hi, I need to have multiple DADs, one for each instance. Do they require a separate port for listening? Is there a document that shows the setup of multiple DADs, on the same OAS? Thanks in advance. Regards, Sindhiya V.

  • How to execute get selected channel for LeCroy Waverunner using VBS

    Hi All, I am trying to get which channel (1 or 2 or 3 or 4) is selected in Oscilloscope? I tried to get the View property of the channels like below:      app.Acquisition.C1.View // but there can be multiple channels whose view property is also true.

  • SAP Code to Return Production Order List for a Given Work Center

    We are looking for native SAP code (BAPI, BADI, FM, ...) that would take a work center value as a parameter and then return all the production orders that have been assigned to that work center. We are running 4.7 and do not have access to BAPI's BAP