Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Foxpro data to .Net
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01153891
Message ID:
01153915
Views:
14
Patrice/Michel,

I'm going to give you two pieces of code, first some purely SQL code that you could run in a stored procedure (or even as a pass-through statement). And then I'll give you some VB.NET code in a 2nd post:

From looking at the PRG, it doesn't appear there are any specific parameters for this process. It looks like you just want to update Mittellog for every row that has an valid entry for ReviewerID and ReviewerCo that exists in ReviewerIDs, and where the Estim_Id doesn't exist in Estimators - and populate the value of Mittellog.estim_id and Bill_Locat from ReviwerIDs.

You can do this as one SQL statement:
UPDATE mittellog SET ESTIM_ID = RV.ESTIM_ID, BILL_LOCAT = RV.BILL_LOCAT
	FROM REVIEWERIDS RV, mittellog ML
	where TRIM(ML.reviewerid) <> '' AND TRIM(ML.reviewerco) <> '' 
	AND ML.reviewerid = RV.reviewerid and ML.reviewerco = RV.reviewerco
	and ML.estim_id not in (select estim_id from estimators)
The only thing I don't understand about this process is that you're replacing Estim_ID in Mittellog with a value from ReviewerIDs, after you first established that it didn't exist in Estimators. If the 'original value' in mittellog differs from the value in reviewerids, it seems maybe you're losing the original value? But maybe that's how it's supposed to work, I don't know. (maybe the value of mittellog.estim_id is initially zero?)

If I'm missing something, let me know.

Anyway, I'll post the .NET code shortly, just wanted to give you a single SQL line that you could use.

Kevin
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform