有一张表,数据如下
编写如下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
执行之后无结果,为什么?
BIG阳
相关分类