alter function F_GetUserPostion(@userName varchar(120)) returns varchar(600)
as
begin
Declare curGetUserPostion Cursor
for
select (select column_Name from Hr_Professional where Column_id=Hr_Intention.GSsortID) from Hr_Intention where GuserName=@userName
Declare @ColumnName varchar(120)
Declare @body varchar(600)
--初始化
Set @body=''
set @ColumnName=''
--打开游标
Open curGetUserPostion
--循环并提取记录
Fetch Next From curGetUserPostion Into @ColumnName
While ( @@Fetch_Status=0 )
begin
--更新到汇总表。
set @body = @body+'-'+@ColumnName
Fetch Next From curGetUserPostion Into @ColumnName
end
--关闭游标
Close curGetUserPostion
--释放游标
Deallocate curGetUserPostion
return @body
end
文章来源:
http://www.cnblogs.com/wangdetian168/archive/2008/12/17/1356848.html
posted on 2010-10-11 09:27
sanmao 阅读(135)
评论(0) 编辑 收藏