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 2000 Forums
 Transact-SQL (2000)
 is it possible to call udf from SP

Author  Topic 

hong_ma
Starting Member

37 Posts

Posted - 2006-04-04 : 11:36:25
is it possible to call a user defined function from the stored procedure in MS SQL 2000? . if possible, how? thanks.

Kristen
Test

22859 Posts

Posted - 2006-04-04 : 11:40:35
"is it possible to call a user defined function from the stored procedure"

Yes

"if possible, how"

Depends on what the UDF does - is it Scalar, or return a Table or something else?

Kristen
Go to Top of Page

hong_ma
Starting Member

37 Posts

Posted - 2006-04-04 : 11:42:17
Thanks, it is Scalar function
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2006-04-04 : 11:51:25
Then you just need something like:

SELECT @MyVar = dbo.MyFunction(MyParameterValue)

don't you?

Kristen
Go to Top of Page

hong_ma
Starting Member

37 Posts

Posted - 2006-04-04 : 11:53:27
Kristen, Thanks, I got it.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-04-05 : 02:39:41
You can also use

SELECT dbo.MyFunction(col) as yourcol, othercolumns from yourTable


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -