Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Function Problem

Author  Topic 

mpolaiah
Starting Member

24 Posts

Posted - 2009-08-18 : 08:27:44
Hi All

my function is

--drop function priority
create function priority
(
@nRequestDetailsID int
)
RETURNS int
AS
begin
declare @pre int, @a int

select @pre = cnt from counter


if(@pre>= 4)
begin
update counter set cnt = 2
end
else
begin
update counter set cnt = cnt+1
end



RETURN @pre

end



but it is not working
the error is.....................



Msg 443, Level 16, State 15, Procedure priority, Line 16
Invalid use of side-effecting or time-dependent operator in 'UPDATE' within a function.
Msg 443, Level 16, State 15, Procedure priority, Line 20
Invalid use of side-effecting or time-dependent operator in 'UPDATE' within a function.


how to slove the problem

please help meeeeeeeeeeeeee

yours
pols

rajdaksha
Aged Yak Warrior

595 Posts

Posted - 2009-08-18 : 08:55:53
Hi

DML statements are invalid in scalar UDFs.

Why do you created function. you can create proc right....





-------------------------
R...
Go to Top of Page
   

- Advertisement -