How to use IIF function in a view 
Author Message
 How to use IIF function in a view
Hi:
I was creating a view in SQL server which I need to use IIF(expression,
string1, string2) function. Does anybody know how to this?
I did this query in access, the original query statement is like:
select iif(month>6, year+1, year) as FY from table1

Thanks in advance.

Haiyan Sui

*** Sent via Developersdex http://www.***.com/ ***
Don't just participate in USENET...get rewarded for it!



Wed, 08 Jun 2005 01:43:55 GMT
 How to use IIF function in a view

Haiyan,

Both ANSI SQL and T-SQL support the CASE expression. The IIF function is an
Access only function.

Try something like:

select case when month > 6 then year + 1 else year end as FY
from table1

-------------------------------------------
BP Margolin
Please reply only to the newsgroups.
When posting, inclusion of SQL (CREATE TABLE ..., INSERT ..., etc.) which
can be cut and pasted into Query Analyzer is appreciated.


Quote:
> Hi:
> I was creating a view in SQL server which I need to use IIF(expression,
> string1, string2) function. Does anybody know how to this?
> I did this query in access, the original query statement is like:
> select iif(month>6, year+1, year) as FY from table1

> Thanks in advance.

> Haiyan Sui

> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!



Wed, 08 Jun 2005 04:22:19 GMT
 
 [ 2 post ] 

 Relevant Pages 

1. iif function in views

2. IIF function inside a view

3. iif functions in views / procedures

4. IIF function in view ???

5. IIF or CASE type function in SQL views

6. IIF FUNCTION IN A VIEW

7. Simulating IIF function in View

8. Using IIF in a View

9. IIF function in sql statement equal to what is used in Access-Query

10. About using iif and other functions

11. Using IIF Function in Sql Server 2000 Query ?

12. view designer says error when using mssql functions in remote views


 
Powered by phpBB® Forum Software