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
 Execute a function

Author  Topic 

Ragabash
Starting Member

6 Posts

Posted - 2008-01-28 : 09:40:19
ALTER Function [dbo].[find_role](@kul_no as int)
Returns nvarchar(50)
AS
BEGIN
declare @role_no as int
set @role_no = (Select gorev_no from r_employee where emplyee_id=@user_no )
declare @role_name as nvarchar(50)
set @role_name=(Select role_explanation from Tasks where role_no=@role_no)
Return @role_name
END
how can I execute this function?

jhocutt
Constraint Violating Yak Guru

385 Posts

Posted - 2008-01-28 : 09:43:33
declare @rc as varchar(50)
exec @rc = dbo.find_role 1
print @rc


"God does not play dice" -- Albert Einstein
"Not only does God play dice, but he sometimes throws them where they cannot be seen."
-- Stephen Hawking
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-01-28 : 09:43:46

Select dbo.find_role(10) -- or other number

Madhivanan

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

- Advertisement -