SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
Register Now and get your question answered!
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 How to add a case checking month no using sysdate
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Aged Yak Warrior

567 Posts

Posted - 02/08/2013 :  12:02:08  Show Profile  Reply with Quote
Is it possible i want to add a case when on top to check if sysdate() month > 2 then go thru below calculation else put value 0.

        SUM(LPAD (TO_CHAR (( (CR_Units_01 + DB_Units_01 + CR_Units_02 + DB_Units_02)/
                                CASE MOD('2013', 4)
                                  WHEN 0 THEN (177.14 + 165.71 ) 
                                  ELSE (177.14 + 160.00 )  
                              )), 'FM99999999990.00'), 11)) 

AS Month2,

Thank you very much for the helpful info.

Flowing Fount of Yak Knowledge

6062 Posts

Posted - 02/08/2013 :  15:53:38  Show Profile  Reply with Quote
do you mean this?:

when datepart(month, getdate()) <= 2 then 0
else <your expression>

sysdate() is oracle, right? If you need oracle help try dbforums - This forum is MS Sql Server specific.

Be One with the Optimizer

Edited by - TG on 02/08/2013 15:56:03
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000