I am using a function listed below, several days ago it shows a error msg
function and recreate it, another error msg said there is a syntax error
near FUNCTION!!!
But in another backup database, the same function works just fine.
Can anybody give your 2 cents on this?
Thanks a lot!
------------------
CREATE FUNCTION TF_GetHotProduct ()
AS
begin
Declare cur_BC CURSOR for select bc_id from bigCategory
open cur_BC
begin
-- for each BigCategory, select one latest new product
begin
products P
join SmallCategory SC on P.Smallclassid=SC.SC_id join MiddleCategory
MCon SC.mc_id=MC.mc_id
join c_tek C on P.product_id = C.Product_id
C.Approved = 'Y'
order by P.CreateAt desc
end
end
deallocate cur_BC
return
end