|
Now, unless there's more to this statement than you've shown
us, there's no need to use dynamic SQL. A static statement would work:
someDateFieldCHAR = %char(someDateField);
Exec SQL
Declare C2 cursor for
Select * From myfile
where myfield = : someDateFieldCHAR;
Exec SQL
Open C1;
if SqlCod <> 0;
/handle error
endif;
Exec SQL
Fetch Next From C2 into :MyFile_DS;
if SqlCod <> 0;
/handle error
endif;
However, remember my motto, "If you're using a cursor you're
probably doing something wrong." You might see the term RBAR
thrown about when it comes to cursors, especially in MS SQL
Server forums.
RBAR stands for Row-By-Agonizing-Row.
There are a few places where you have to use cursors, but
this isn't one of them!
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.