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
 General SQL Server Forums
 New to SQL Server Programming
 query error : is not a recognized built-in functio

Author  Topic 

Alaveh
Starting Member

24 Posts

Posted - 2011-09-29 : 19:28:01
Hi

my Query has an error .
any one can help me please ?

error :
Msg 195, Level 15, State 10, Line 7
'getSumBSen2' is not a recognized built-in function name.

query :

create function getSumBSen2(@pfcode INT, @pdcode INT, @pSen INT) returns INT
as
begin
declare @r INT;
select
@r= sum(t2.t_shab + t2.t_rooz)
from
tbl_talafat_dan t2
where
t2.FCode = @pfcode
and t2.DCode = @pdcode
and t2.sen <= @pSen;

return (@r);
end;
GO

select
t1.sen,
sum(t1.d_rooz) as d1,
sum(t1.t_shab) as d2,
sum(t1.d_rooz + t1.t_shab) as d_sum,
Round((sum((1000*(t1.d_rooz+t1.t_shab))/(9500-(getSumBSen2(t1.FCode, t1.dcode, t1.sen))))),1) as SSS
from
tbl_talafat_dan t1
where
t1.FCode = 81
and t1.DCode = 1
group by
t1.sen;

pduffin
Yak Posting Veteran

68 Posts

Posted - 2011-09-29 : 19:39:42
put dbo. in front of the function name in the select query. This works for me.
Pete
Go to Top of Page

tduggan
Starting Member

26 Posts

Posted - 2011-09-29 : 19:40:25
That's what I told you to do in your other thread.
Go to Top of Page

Aleph_0
Yak Posting Veteran

79 Posts

Posted - 2011-09-29 : 19:41:09
Same error as your other thread - add "dbo." to the function name when you use it in your SELECT statement.
Go to Top of Page

Aleph_0
Yak Posting Veteran

79 Posts

Posted - 2011-09-29 : 19:42:05
Dang, too slow....
Go to Top of Page

Alaveh
Starting Member

24 Posts

Posted - 2011-09-29 : 20:04:54
oh my god

after 3 or 4 days it works :D

the sql server always write dbo before tables but i never wrote dbo and had no problem .

thank you tduggan and you Aleph_0
Go to Top of Page

tduggan
Starting Member

26 Posts

Posted - 2011-09-29 : 20:07:32
Functions require it even if you are that owner. Not sure why they are so picky, kinda annoying.
Go to Top of Page
   

- Advertisement -