Hi,
I need to retrieve both Mont and Quarter from an MS SQL server field containing a date as ''01/01/2007 12:10:00'.
Retrieving the Month is working properly, but getting some sql error with the Quarter function.
I will appreciate if someone can indicate me how should I do in order to retrieve the Quarter from a date.
To retrieve the month, I am using:
& "MONTH(STOCK.VALUEDATE) AS 'Month'"
To retrieve the Quarter, I am trying (but getting error):
& "QUARTER(STOCK.VALUEDATE) AS Quarter"
Thanks,
Aldo.
I already got the answer...
& "STOCK.VALUEDATE AS 'Original Date', " _
& "DATEPART(month, STOCK.VALUEDATE) AS 'Month', " _
& "DATEPART(quarter, STOCK.VALUEDATE) AS 'Quarter', " _
& "DATEPART(year, STOCK.VALUEDATE) AS 'Year', " _
Thanks anyway,
Aldo.
|||Aldo,Please use the Transact-SQL forum for these kinds of questions. This has nothing to do with SSIS.
Thanks,
Phil
No comments:
Post a Comment