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.
| Author |
Topic |
|
Alaveh
Starting Member
24 Posts |
Posted - 2011-09-29 : 19:28:01
|
| Himy 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 INTasbegin 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;GOselect 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 t1where 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 |
 |
|
|
tduggan
Starting Member
26 Posts |
Posted - 2011-09-29 : 19:40:25
|
That's what I told you to do in your other thread. |
 |
|
|
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. |
 |
|
|
Aleph_0
Yak Posting Veteran
79 Posts |
Posted - 2011-09-29 : 19:42:05
|
| Dang, too slow.... |
 |
|
|
Alaveh
Starting Member
24 Posts |
Posted - 2011-09-29 : 20:04:54
|
| oh my godafter 3 or 4 days it works :Dthe sql server always write dbo before tables but i never wrote dbo and had no problem .thank you tduggan and you Aleph_0 |
 |
|
|
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. |
 |
|
|
|
|
|
|
|