27,579
社区成员
发帖
与我相关
我的任务
分享
create proc mytest(@tmp nchar(10))
as
begin
declare @t_id nchar(12)
declare @t_title nchar(40)
/*问题 是不是查询语句都是定死的,如果是这样不是显的很不灵活。*/
declare cur_test cursor for select t_id,t_title from test where col = @tmpopen
cur_test
fetch next from cur_test into @t_id,@t_title while @@fetch_status=0
begin
/*这里可以写IF ELSE 做一些判断等等*/
print +' '+@t_id+' '+@t_title
fetch next from cur_test into @t_id,@t_title
end
close cur_test
deallocate cur_test
end