February 14, 2012 at 2:10 pm
Hello,
I am testing the first part of an SSIS package and getting stuck on a date column.
SELECT <SOURCE> as [Client], <INV> as [InvNo], <CRDate>
FROM <SRC>
INNER JOIN <CLIENT> on <SRC>.<SOURCE> = <CLIENT>.<ID>
AND <CRDate> = (SELECT MIN(<CRDate>) FROM <SRC> WHERE <SOURCE>=<CLIENT>.<ID>)
I get the "first invoice date".
I want to create a DERIVED COLUMN in a step to take the "first invoice date" and find the last day of the previous month for that date.
I can get the last day previous month but using GETDATE() so I get the current month previous.
I am having trouble with the expression. Any ideas?
February 14, 2012 at 2:21 pm
this may help
http://www.sqlservercentral.com/blogs/lynnpettis/2009/03/25/some-common-date-routines/
________________________________________________________________
you can lead a user to data....but you cannot make them think
and remember....every day is a school day
February 14, 2012 at 2:33 pm
The expressions I have tried work great for today's (last day of previous month) I cannot get it to evaluate the date of the first invoice and find the last day of the previous month.
This seems very simple but I wouldn't know.
February 14, 2012 at 3:35 pm
Are you building a Select statement to be used in an SSIS import package?
Can you do the logic in your SQL statement rather than a derived column within the package?
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply