有一张表,数据如下编写如下sql语句/****** Script for SelectTopNRows command from SSMS ******/declare @output nvarchar(max)declare @year char(4)declare @startdate datetimedeclare reader cursor forSELECT distinct TOP 10 [cme_year]
,[start_date]FROM [ayn_cme_year] order by cme_yearopen readerfetch next from reader into @year,@startdatewhile @@fetch_status=0beginset @output=@output+convert(nvarchar(4),@year)+' '+convert(nvarchar(10),@startdate)+' '
fetch next from reader into @year,@startdateendselect @outputclose readerdeallocate reader执行之后无结果,为什么?
- 1 回答
- 0 关注
- 799 浏览
添加回答
举报
0/150
提交
取消