dcsimg
Results 1 to 3 of 3

Thread: Third tuesday of every month.

  1. #1
    Join Date
    Feb 2009
    Posts
    3

    Third tuesday of every month.

    I need to create a query that will insert record but date should be either 1st or the 3rd tuesday of each month, what code should i use.

  2. #2
    Join Date
    Feb 2009
    Posts
    3

    Third tuesday of every month

    or you can just give me code for third Tuesday of each month.

  3. #3
    Join Date
    Feb 2009
    Posts
    3

    Third tuesday of every month

    Here is a solution:


    SELECT @ResultDate = DATEADD(wk, DATEDIFF(wk,0, dateadd(dd, 18 - datepart(day,getdate()),getdate()) ), 1);

    this will return me Tuesday of a specific month( in this case its system date) and if i use while loop with dateadd function i can get the result.

    I hope it will help others.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •