Avatar of PeterErhard
PeterErhard

asked on 

Derived Column Transformation Editor

Is there an expression I can use in the screen-print attached for getting the last calendar day of the proceding month?

I can get what I want through the following query, but am not sure how the expression should look.

SELECT
      DATEADD(d, -1, FirstOfCurrentMonth) as LastOfPreviousMonth
FROM
(
SELECT
      CONVERT(smalldatetime,DATENAME(m, GetDate())+ ' 1,' + DATENAME(yyyy, GETDATE())) as FirstOfCurrentMonth
)  a
derived-column-transformation-ed.JPG
Microsoft SQL ServerMicrosoft SQL Server 2005

Avatar of undefined
Last Comment
Anthony Perkins
Avatar of Anthony Perkins
Anthony Perkins
Flag of United States of America image

How about this:

Select DATEADD(day, -Day(GETDATE()), GETDATE())
Nevermind I see you want the equivalent SSIS expression.
Avatar of PeterErhard
PeterErhard

ASKER

Yes that's right, thanks anyway though :)
ASKER CERTIFIED SOLUTION
Avatar of Anthony Perkins
Anthony Perkins
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of PeterErhard
PeterErhard

ASKER

Thanks a lot , that did the trick :)
There is the little detail of the included time, but I trust you have that figured out.

Thanks.
Microsoft SQL Server
Microsoft SQL Server

Microsoft SQL Server is a suite of relational database management system (RDBMS) products providing multi-user database access functionality.SQL Server is available in multiple versions, typically identified by release year, and versions are subdivided into editions to distinguish between product functionality. Component services include integration (SSIS), reporting (SSRS), analysis (SSAS), data quality, master data, T-SQL and performance tuning.

171K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo