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 & ")