hi,
How to get last (maximum) date of a month through sql
query.
ex: if 31st is the last date of a month then i should get
31(dd) or 31/03/2005(dd/mm/yyyy) format or 20050331
(yyyymmdd) format.
Thanks,
hari.
SELECT
CONVERT(char(8),DATEADD(dd,-DAY(GETDATE()),DATEADD(mm,1,GETDATE())),112)
Dejan Sarka, SQL Server MVP
Associate Mentor
www.SolidQualityLearning.com
"Hari" <anonymous@.discussions.microsoft.com> wrote in message
news:098501c52e7f$2ce31110$a501280a@.phx.gbl...
> hi,
> How to get last (maximum) date of a month through sql
> query.
> ex: if 31st is the last date of a month then i should get
> 31(dd) or 31/03/2005(dd/mm/yyyy) format or 20050331
> (yyyymmdd) format.
> Thanks,
> hari.
>
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment