How can I order data in a cursor? Can we use the order by clause
? Because I need to sort the data first.
thanks
How can I order data in a cursor? Can we use the order by clause
? Because I need to sort the data first.
thanks
I am not sure what database you are using but it is possible in SQL Server.
for e.g.:
DECLARE vendor_cursor CURSOR FOR SELECT VendorID, Name FROM Purchasing.Vendor WHERE PreferredVendorStatus = 1 ORDER BY VendorID
I know there was some problem with that but it can be solved using select * from (select a, b from t order by a)