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
 Development Tools
 Reporting Services Development
 Matching

Author  Topic 

nana_81
Starting Member

9 Posts

Posted - 2005-01-17 : 01:48:52
i have field that has char like S, L, and D what i wanted to do is if the feild has S so diplay Surplus if it has L so diplay Limit i used select Iif(BO01BOT.equal('S'), 'Surplus', Iif(BO01BOT.equal('D'), 'Deficite')) AS OutPut from tableName but it gives me an error iif is not recognized function

mde
Starting Member

10 Posts

Posted - 2005-01-17 : 05:28:19
If I understand your problem correct you would like to do like this.

This code is written as an expression in a textbox:

=iif( Fields!BO01BOT.Value = "S", "Surplus", iif( Fields!BO01BOT.Value = "D", "Deficite", iif(Fields!BO01BOT.Value ="L", "Limit", "Unknown")))


You can do this in a sql-query as well, with a case-statement.

// Maria
Go to Top of Page

nana_81
Starting Member

9 Posts

Posted - 2005-01-18 : 00:11:03
hi maria
could you provide me with an example
Go to Top of Page

jhermiz

3564 Posts

Posted - 2005-01-18 : 00:48:06
You can use case statements within your select. Give this sucka
a try

SELECT
SomeField1, SomeField2,
CASE Bo01BOT
WHEN 'S' THEN 'Surplus'
WHEN 'D' THEN 'Deficit'
WHEN 'L' THEN 'Limit'
END AS TheResult
FROM YourTable





Keeping the web experience alive -- [url]http://www.web-impulse.com[/url]


Go to Top of Page

nana_81
Starting Member

9 Posts

Posted - 2005-01-18 : 01:00:58
thnx alot maria
SELECT CASE BO01BOT WHEN 'S' THEN 'Surplus' WHEN 'L' THEN 'Limit' WHEN 'D' THEN 'Deficite' END AS ModBOT
FROM table-name
Go to Top of Page
   

- Advertisement -