Avatar of VTFatcat1973
VTFatcat1973
 asked on

Get Current Year Syntax in Switch Statement SSRS 2005

In the following Switch statment, I have hard-coded the date 12/31/2010; however what I really need to do is have 0000 = 12/31/CurrentYear. Can someone please help me with the syntax.
Thanks,

=Switch
(   Fields!Combo_3.Value = 0001,DateAdd("D",730,Fields!Birthdate.Value),
    Fields!Combo_3.Value = 9999,"N/A",
    Fields!Combo_3.Value = 0000,CStr("12/31/2010"),
    Fields!Combo_3.Value = 0002,"Past Due",
    Fields!Combo_3.Value,Format( Mid( Fields!Combo_3.Value ,5,2 ) & "/" &
    Right( Fields!Combo_3.Value , 2 ) & "/" &
    Left( Fields!Combo_3.Value , 4 ) )  

   
   
)
Microsoft SQL ServerSSRSSQL

Avatar of undefined
Last Comment
VTFatcat1973

8/22/2022 - Mon
rockiroads

try this

year(getdate())

or

Select datepart(year,getdate())
SOLUTION
rockiroads

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
ASKER CERTIFIED SOLUTION
Shaun Kline

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
rockiroads

yes true lol. I missed SSRS in the title and read the zone, doh!
VTFatcat1973

ASKER
You both were a big help. I split up the points see I kinda mislead with T-SQL as it was SSRS code. Shaun's Syntax was right on ;-) Thanks
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes