Has anyone got an example of using PREPARED SQL in conjunction with cursors? I've used them before with Informix but I don't know what the syntax is for SQL Server - I've found loads of references on Microsite site but no actual examples.
I do not know the syntax for PREPAREing SQL, and neither do I know the syntax for FETCHing a row while passing in the parameter.
I want to prepare a cursor where the join is based on values determined at run time. Something like....
Thanking you in advance....Code:PREPARE sSQL as SELECT title, cat_no FROM titles t, order o WHERE o.order_no = ? DECLARE cur1 CURSOR FOR sSQL ... FETCH cur1 USING @sOrdNo INTO @sTitle, @sCatNo




Anakim
Reply With Quote