下面这个函数有这个错误,不知为什么? 错误444:函数中含有的select 语句无法向客户端返回数据
clkun 2005-11-15 12:16:12 Create table a (dept_name nvarchar(20),dept_id Smallint)
Create table b (Stuffs Nvarchar(20),dept_id Smallint,s_id Smallint)
Insert Into a values ('办公室',1)
Insert Into a values ('财务室',2)
Insert Into b values ('张三',1,1)
Insert Into b values ('李四',1,2)
Insert Into b values ('王五',2,3)
下面这个函数有这个错误,不知为什么?
错误444:函数中含有的select 语句无法向客户端返回数据
Create Function lname (@id smallint)
RETURNS NVarchar
AS
Begin
Declare @New_Files NVarchar, @Stuffs_Name NVarchar, @s_id smallint
Declare Employee_Cursor Cursor For Select Stuffs,s_id from b Where dept_id = @id
Open Employee_Cursor
Fetch Next From Employee_Cursor
Into @Stuffs_Name, @s_id
While @@FETCH_STATUS = 0
Begin
Set @New_Files = @New_Files+'|||'+@Stuffs_Name + '|' + @s_id
Fetch Next From Employee_Cursor
End
RETURNS(@New_Files)
Close Employee_Cursor
Deallocate Employee_Cursor
End
GO