关于Function的创建问题
create function GetDiveTripIDsByMemberName(
@memberName nvarchar(50)='',
@TopNum int=-1
)
returns table
as
begin
if @TopNum =-1
select ID,Describe from T_SBSTrips where username=@memberName order by CreateDate
else
declare @sql nvarchar(4000)
set @sql='select top '+cast(@TopNum as nvarchar(8))+' ID,Describe from T_SBSTrips where username='
+@memberName+' order by CreateDate'
exec (@sql)
end
return
end
我这样子创建系统提示我的出问题了,谁知道这个要怎么改啊??谢谢了