Hi Guys,
I've created a cursor inside a function. When I break it down and execute the code piece by piece, no problem. However, try and parse it together and I get an error - 'Mixing old and new syntax is not allowed?' Something to do with the return statements? as I can alter the function to a procedure and it parses fine. Anyone come across this before?
Also, the values are being rounded when putting them into the cursor, even though I've declared the variables the cursor uses specifically as decimal? How can I get around this please?
Cheers,
Michelle
Michelle:
Can you describe what you are doing? This sounds rather vague.
|||Blast, it didn't post. Umm, I've sorted the first problem, and I think I may have the answer to the second one. Will give it a go and let you know. Thanks for your help!
Cheers,
Michelle
|||OK, both of those problems fixed. Should have been
DECLARE product_cursor CURSOR local SCROLL
NOT
DECLARE product_cursor SCROLL CURSOR
and Should have been:
decimal(8,2)
NOT
decimal.
Stupid mistakes! However, now I'm able to parse it fine, but am getting:
Msg 443, Level 16, State 15, Procedure CalculateFreight, Line 15
Invalid use of side-effecting or time-dependent operator in 'SELECT INTO' within a function.
Msg 443, Level 16, State 15, Procedure CalculateFreight, Line 25
Invalid use of side-effecting or time-dependent operator in 'UPDATE' within a function.
when I execute it!?
The SELECT INTO and UPDATE statements are fine when executed alone
Michelle
sql
No comments:
Post a Comment