Viewing 4 posts - 1 through 4 (of 4 total)
Hi chiesa,
Your Suggestion will also work... But
As per Performance Tuning matter,
in your Solution.
First of all the Data will be Sorted in DESC Order and then It will Apply...
April 14, 2015 at 4:42 am
Hi,
You Can achieve the same Result by below statement for FIRST_VALUE and LAST_VALUE
------------------------------------------------FIRST_VALUE-------------------------------------------------------
SELECT
CustomerID
, SalesOrderID
...
April 14, 2015 at 3:20 am
Hi,
This is Simple Function to get Month days for current Month
/***********************************************/
/***********************************************/
/***********************************************/
CREATE FUNCTION dbo.FnDaysOfCurrentMonth(@myDate DATE) RETURNS INT
AS
BEGIN
DEclare @Month int
DECLARE @days int
select @month=month(@myDate)
IF @Month =2
BEGIN
IF (Year(@myDate)%4)=0
BEGIN
SET @days=29
END
ELSE
BEGIN
set @days=28
END
END
ELSE
BEGIN
select @days =day(DATEADD(s,-1,DATEADD(mm, DATEDIFF(m,0,@myDate)+1,0)))
END
RETURN @days
END
November 4, 2014 at 4:09 am
Viewing 4 posts - 1 through 4 (of 4 total)