February 11, 2008 at 6:48 am
Hallo
I have this problem. My T-SQL script looks like this and I must convert it to SQL to work in Visual FoxPro 9. How can I do it? Or anybody knows better solution? Thank you very much ...
--------------------------------------------------------------------
SELECT
StartTime=CAST(v.K1 AS char(12), EndTime=CAST(a.k1 AS char(12)),
StartVal=v.c1, EndVal=a.c1,
Change=SUBSTRING('- +',SIGN(a.c1-v.c+)+2,1)+CAST(ABS(a.c1-v.c1) AS varchar)
FROM
(SELECT k1, c1, ranking=(SELECT COUNT(DISTINCT K1) FROM #valueset U
WHERE U.K1 <= 1.K1)
FROM #valueset 1) V LEFT OUTER JOIN
(SELECT K1, c1, ranking=(SELECT COUNT(DISTINCT k1) FROM #valueset U
WHERE #valueset 1) a
ON (a.ranking=v.ranking+1)
WHERE a.k1 IS NOT NULL
February 11, 2008 at 12:21 pm
I need a little bit more info...
1. There are several syntax errors in the script that I can see
a. Your cast for StartTime is missing a closing parenthesis
b. Your "change" assignment in your last select item has an incomplete calculation
If those things don't fix it, then...
2. Are you doing SQL pass-through in FoxPro, or do you want it to run natively in FoxPro (on FoxPro tables)?
If you're doing passthrough, then maybe you can create a stored proc in SQL and just call it from FoxPro. Do all of the heavy lifting in the arena that is built for it. FoxPro is nice for quick local data access, but if you want to leverage SQL, then do it all there and make FoxPro your presentation layer.
Hope this helps.
Dan
February 11, 2008 at 3:49 pm
Thank you very much for your response. I find the whole my problem and I gave it to word document. You can look at it. If you will have time, please, you can do it for me in Visual FoxPro. I am trying it the whole day and I am not success ...
February 12, 2008 at 6:14 am
Everything is a pasted image - if you paste the actual text I would have time to help you. I don't have the bandwidth to do the OCR and check it for errors.
Are you working with a SQL backend through FoxPro, or trying to use native T-SQL within FoxPro? If you have this working in SQL Server - just create a stored proc on the server and call it through VFP.
It's been a while since I used VFP, but it was always missing some T-SQL functionality when I worked with it...
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply