Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Mikha sutanto
  Where is Mikha sutanto?
 Singapore
 Singapore
 Mikha sutanto
 To: Gerzon
  Where is Gerzon?
 Yogyakarta
 Indonesia
 Gerzon
 Tags
Subject: RE: Function IIF() only work in VFP not In SQl Server 2000
Thread ID: 112377 Message ID: 112386 # Views: 3 # Ratings: 0
Version: Visual FoxPro 8 Category: Databases, Tables and SQL Server
Date: Wednesday, November 08, 2006 4:42:47 AM         
   


Try Using :

CASE input_expression
WHEN when_expression THEN result_expression
[ ...n ]
[
ELSE else_result_expression
]
END

Example :

USE pubs
GO
SELECT Category =
CASE type
WHEN 'popular_comp' THEN 'Popular Computing'
WHEN 'mod_cook' THEN 'Modern Cooking'
WHEN 'business' THEN 'Business'
WHEN 'psychology' THEN 'Psychology'
WHEN 'trad_cook' THEN 'Traditional Cooking'
ELSE 'Not yet categorized'
END,
CAST(title AS varchar(25)) AS 'Shortened Title',
price AS Price
FROM titles
WHERE price IS NOT NULL
ORDER BY type, price
COMPUTE AVG(price) BY type
GO




> Hi experts,
> is IIF() Function Work with SPT that I sent to SQL server as Back End, here I send this Query :
>
MSQL=[SELECT A.NO_REKENING,C.NM_REKENING,B.NM_ACC_TYPE,IIF(ISNULL(A.SALDO_AWAL),A.SALDO_AWAL,0) AS SALDO  FROM SALDO_AWAL_REKENING A]+;
> 	[ LEFT JOIN REKENING C ON A.NO_REKENING=C.NO_REKENING]+;
> 	[ LEFT JOIN ACC_TYPE B ON C.KD_ACC_TYPE=B.KD_ACC_TYPE]
> 
> IF SQLEXEC(KONEKSI_KE_SERVER,MSQL,"CRS_DARI_REKENING")<=0
> 	=MESSAGEBOX("QUERY... KE SERVER FAIL..."+MESSAGE(),0+16,"WARNING....")
> 	RETURN
> ENDIF

>
> error message show me :
> QUERY... KE SERVER FAIL...Connectivity Error :[Microsoft][ODBC SQL Server Driver][SQL Server]The isnullfunction requires 2 arguments. IIF()function work fine in VFP. is SQL command that I excecute in SQLEXEC() funtion is SQL Server-SQL Statement not VFP SQL Statement?
>
> TIA
> regards
> Gerzon


ENTIRE THREAD

Function IIF() only work in VFP not In SQl Server 2000 Posted by Gerzon @ 11/8/2006 2:08:57 AM
RE: Function IIF() only work in VFP not In SQl Server 2000 Posted by Mikha sutanto @ 11/8/2006 4:42:47 AM
RE: Function IIF() only work in VFP not In SQl Server 2000 Posted by Agung Kurnianto @ 11/8/2006 5:43:10 AM