Solved

Get Current Year Syntax in Switch Statement SSRS 2005

Posted on 2010-11-12
5
828 Views
Last Modified: 2012-05-10
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 ) )  

   
   
)
0
Comment
Question by:VTFatcat1973
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 65

Expert Comment

by:rockiroads
ID: 34123449
try this

year(getdate())

or

Select datepart(year,getdate())
0
 
LVL 65

Assisted Solution

by:rockiroads
rockiroads earned 200 total points
ID: 34123474
doh!, thats just the year part

not sure if this would work though

,CStr("12/31/" + year(getdate())),

or perhap build like this

 "12/31/" + cast(year(getdate()) as varchar)
0
 
LVL 26

Accepted Solution

by:
Shaun Kline earned 300 total points
ID: 34123505
Or maybe
"12/31/" & CStr(Year(Today()))
since it looks like SSRS code, not T-SQL code.

0
 
LVL 65

Expert Comment

by:rockiroads
ID: 34123549
yes true lol. I missed SSRS in the title and read the zone, doh!
0
 

Author Closing Comment

by:VTFatcat1973
ID: 34123740
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
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I'm trying, I really am. But I've seen so many wrong approaches involving date(time) boundaries I despair about my inability to explain it. I've seen quite a few recently that define a non-leap year as 364 days, or 366 days and the list goes on. …
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question