Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
How to get the max date using the quarter number and year number.QtrNum = 4YearNum = 2010Thank you very much for the helpful info.
visakh16
Very Important crosS Applying yaK Herder
52326 Posts
Posted - 2011-10-13 : 12:30:23
do like
DECLARE @QtrNum int,@YearNum intSELECT @QtrNum=4,@YearNum=2010SELECT DATEADD(qq,@QtrNum,DATEADD(yy,@yearNum-1900,0))-1 AS MaxDate,DATEADD(qq,@QtrNum-1,DATEADD(yy,@yearNum-1900,0)) AS minDate
------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/
cplusplus
Aged Yak Warrior
567 Posts
Posted - 2011-10-13 : 12:38:40
Excellent.....Thank you very much Visakh.
visakh16
Very Important crosS Applying yaK Herder
52326 Posts
Posted - 2011-10-13 : 12:40:24
wc------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/