dbTalk Databases Forums  

IIF and SET expression. (AS200)

microsoft.public.sqlserver.olap microsoft.public.sqlserver.olap


Discuss IIF and SET expression. (AS200) in the microsoft.public.sqlserver.olap forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Vladimir Chtepa
 
Posts: n/a

Default IIF and SET expression. (AS200) - 02-13-2006 , 07:20 AM






Hi,

Why I can't use IIF with set expression?
For example

with

set myset as 'IIF(a<b, SetExpression1, SetExpression2)'

select

....

I there any workaround?
In AS2005?

Thanks
Vladimir



Reply With Quote
  #2  
Old   
Vladimir Chtepa
 
Posts: n/a

Default Re: IIF and SET expression. (AS200) - 02-13-2006 , 07:29 AM






I have an workaround under AS2000. It is StrToSet and SetToStr.

But it is pure ( counting exercise.


"Vladimir Chtepa" <vc.nospam (AT) diacom-systemhaus (DOT) nospam.de> schrieb im
Newsbeitrag news:uPvc0AKMGHA.420 (AT) tk2msftngp13 (DOT) phx.gbl...
Quote:
Hi,

Why I can't use IIF with set expression?
For example

with

set myset as 'IIF(a<b, SetExpression1, SetExpression2)'

select

...

I there any workaround?
In AS2005?

Thanks
Vladimir




Reply With Quote
  #3  
Old   
Vladimir Chtepa
 
Posts: n/a

Default Re: IIF and SET expression. (AS200) - 02-13-2006 , 07:47 AM



In AS2005 it is out of box supported.

"Vladimir Chtepa" <vc.nospam (AT) diacom-systemhaus (DOT) nospam.de> schrieb im
Newsbeitrag news:uPvc0AKMGHA.420 (AT) tk2msftngp13 (DOT) phx.gbl...
Quote:
Hi,

Why I can't use IIF with set expression?
For example

with

set myset as 'IIF(a<b, SetExpression1, SetExpression2)'

select

...

I there any workaround?
In AS2005?

Thanks
Vladimir




Reply With Quote
  #4  
Old   
Darren Gosbell
 
Posts: n/a

Default Re: IIF and SET expression. (AS200) - 02-22-2006 , 06:06 AM



In AS 2000, the IIF statement can only return strings or integers. And
both sides of the statement need to use the same data type

eg:

IIF( a < b, Str1, Str2)

or:

IIF( a < b, int1, int2)

something like:

IIF( a < b, Str1, int2)

will not work. Thus your work around of using StrToSet is all you can do
in AS 2000.

--
Regards
Darren Gosbell [MCSD]
Blog: http://www.geekswithblogs.net/darrengosbell

In article <uPvc0AKMGHA.420 (AT) tk2msftngp13 (DOT) phx.gbl>, vc.nospam@diacom-
systemhaus.nospam.de says...
Quote:
Hi,

Why I can't use IIF with set expression?
For example

with

set myset as 'IIF(a<b, SetExpression1, SetExpression2)'

select

...

I there any workaround?
In AS2005?

Thanks
Vladimir




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.