Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. sponsors. rss.
 From: Yuri Rubinov
  Where is Yuri Rubinov?
 Philadelphia
 Pennsylvania - United States
 Yuri Rubinov
 To: Michael Covington
  Where is Michael Covington?
 Pinehurst
 North Carolina - United States
 Michael Covington
 Tags
Subject: RE: Case statement
Thread ID: 49666 Message ID: 49669 # Views: 19 # Ratings: 0
Version: Unknown Category: Visual Basic
Date: Monday, August 23, 2004 6:36:03 PM         
   


Use IIF() statement instead of VB case, strtran() or chrtran() instead of replace, and inlist() instead of IN.
Make sure that all the data have the very same length (looks like ut should be 10 here)

Something like (not sure about VB & here):

select;
padr(IIF(INLIST(svcarrtype," & 24 & "," & 22 & "), chrtran(svcarrfmt,....),;
iif(svcarrtype = " & 20 & ", RIGHT(LEFT(svcarrfmt, 16), 10),;
iif(INLIST(svcarrtype," & 17 & "),rtrim(ltrim(aggrfmt)) ,svcarrfmt))),10) AS svcarrfmt;
From saxref ;
WHERE NOT INLIST(svcarrtype," & 11 & "," & 13 & "," & 16 & "," & 15 & ")



> I have an SQL query that I have been running from a VB app to a SQL server database. I would like to run this same query on the same data set in FoxPro free table. Can anyone tell me how to convert this query so that I can execute it from VB? The only thing I have changed here is the removal of the single quote characters.
>
> SELECT case when svcarrtype in (" & 24 & "," & 22 & ") then replace(replace(svcarrfmt," & " " & "," & "" & ")," & "-" & "," & "" & ") when svcarrtype = " & 20 & " then RIGHT(LEFT(svcarrfmt, 16), 10) when svcarrtype in (" & 17 & ") then rtrim(ltrim(aggrfmt)) else svcarrfmt end as svcarrfmt From saxref WHERE svcarrtype NOT IN (" & 11 & "," & 13 & "," & 16 & "," & 15 & ")




COMPLETE THREAD
Case statement Posted by Michael Covington @ 8/23/2004 4:52:10 PM
RE: Case statement Posted by Yuri Rubinov @ 8/23/2004 6:36:03 PM