有一張表,數(shù)據(jù)如下編寫如下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執(zhí)行之后無結(jié)果,為什么?
Sql server cursor問題
青春有我
2018-07-23 15:15:09