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

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Simple Problem with an IF statement
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Todzilla
Starting Member

USA
8 Posts

Posted - 02/05/2014 :  09:22:57  Show Profile  Reply with Quote
This should be an easy one, but it's driving me crazy.

I need to check a value. If it is "System Process" I need to output a string. If it's anything else, I need to return that value.

Tried this to no avail:

=IIF(Fields!ObjectName.Value = "System Process" , "Not Yet Checked out" , =Fields!ObjectName.Value)

What's the syntax for returning the value in an else statement?

Thanks in Advance.

Todzilla
Western Hemisphere
SQL 2008 R2 Noob

SwePeso
Patron Saint of Lost Yaks

Sweden
30282 Posts

Posted - 02/05/2014 :  12:27:17  Show Profile  Visit SwePeso's Homepage  Reply with Quote
Are you using Reporting Service or T-SQL?



Microsoft SQL Server MVP, MCT, MCSE, MCSA, MCP, MCITP, MCTS, MCDBA
Go to Top of Page

bitsmed
Constraint Violating Yak Guru

433 Posts

Posted - 02/05/2014 :  12:29:39  Show Profile  Reply with Quote
try removing the equal sign from the "else" statement.
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

Sweden
30282 Posts

Posted - 02/06/2014 :  04:13:41  Show Profile  Visit SwePeso's Homepage  Reply with Quote
In T-SQL
SELECT  CASE
            WHEN Value = 'System Process' THEN 'Not Yet Checked Out'
            ELSE Value
        END
FROM    dbo.Table1



Microsoft SQL Server MVP, MCT, MCSE, MCSA, MCP, MCITP, MCTS, MCDBA

Edited by - SwePeso on 02/06/2014 04:13:59
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.06 seconds. Powered By: Snitz Forums 2000