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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Simple Problem with an IF statement

Author  Topic 

Todzilla
Starting Member

8 Posts

Posted - 2014-02-05 : 09:22:57
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

30421 Posts

Posted - 2014-02-05 : 12:27:17
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
Aged Yak Warrior

545 Posts

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

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2014-02-06 : 04:13:41
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
Go to Top of Page
   

- Advertisement -