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 |
|
zakeer
Starting Member
20 Posts |
Posted - 2008-03-18 : 08:39:02
|
| Can we use a system defined funtion inside a userdefined function?I am facing prob ...try to sort it outcreate function fncube(@i int)returns intas begin declare @output int set @output = power(@i,3) returns @output endwhen i executing this, it is not getting executed.help meThanks & RegardsZakeer |
|
|
elancaster
A very urgent SQL Yakette
1208 Posts |
Posted - 2008-03-18 : 08:42:45
|
quote: create function fncube(@i int)returns intasbegindeclare @output intset @output = power(@i,3)returns @outputend
should be... create function fncube(@i int)returns intasbegindeclare @output intset @output = power(@i,3)return @outputend Em |
 |
|
|
elancaster
A very urgent SQL Yakette
1208 Posts |
Posted - 2008-03-18 : 08:43:44
|
or just...create function fncube(@i int)returns intasbeginreturn power(@i,3)end Em |
 |
|
|
PABluesMan
Starting Member
26 Posts |
Posted - 2008-03-24 : 15:39:47
|
| My guess is that you aren't calling the function with the schema prefix. So, instead of calling:SELECT fncube (3)... you need to call ...SELECT dbo.fncube (3)That is, of course, assuming that the function was created under the [dbo] schema.Hope this helps! |
 |
|
|
QAZAFI
Yak Posting Veteran
50 Posts |
Posted - 2008-03-24 : 23:51:20
|
| Hi dear You need to put "return" not "returns" and also you have to tell which schema this function belongs to by default it belong to dbo hope this will help :)create function fncube(@i int)returns intasbegindeclare @output intset @output = power(@i,3)return @outputendSELECT dbo.fncube (3) |
 |
|
|
|
|
|