Crystal Reports & SQL Reporting Services Training Consultants
Account Log in:
Username:
Password:
Excellence can be obtained if you care more than others think is wise, risk more than others think is safe, dream more than others think is practical, expect more than others think is possible
 
Unknown
Institute of IT Trainers - Freelance Trainer of the Year 2006 & 2009
Liverpool Business Connect Member
  Maximum Impact Solutions Limited - Reporting Solutions, Creating Answers
Reporting Solutions - Creating Answers, Crystal Reports, Dashboarding (Xcelsius) & SQL Reporting Services

The Maximum Impact Solutions Blog Feed ME!!!!

14
September

How Do I Calculate the Last Friday of the Previous Month using SQL

During a recent SQL Server Reporting Services report writing project I needed to write some SQL to calculate the last Friday of the previous month for report parameters

Solution:

The SQL code to calculate the Last Friday of the Previous Month:

SELECT DateAdd(d,-1((datepart (dw, DateAdd (d,-1, DateAdd(mm, Datediff (m,0, GetDate()),0)))+)% 7), DateAdd (d, -1, DateAdd (d, 0, DateAdd (mm, Datediff(m, 0, Getdate()),0))))


If you have any questions, leave us a comment below, or need any assistance, please do not hesitate to Contact Us

MAKE A COMMENT

Name *

Email Address *

Comment *

To prove you are human what is:

82 + 68 =