我有记录列表并创建了游标来遍历每条记录并检查某些条件并返回记录,如果它满足我的游标如下:
DECLARE @ID int
DECLARE @FromDate datetime, @ToDate datetime
DEClare @expid as int
set @expid = 839
DECLARE IDs CURSOR FOR
select patpid,fromdate,todate from tdp_ProviderAccomodationTariffPlan where fk_patid = 162 and fk_pacid = 36
OPEN IDs
FETCH NEXT FROM IDs into @ID,@FromDate,@ToDate
WHILE @@FETCH_STATUS = 0
BEGIN
print @ID
print @FromDate
print @ToDate
--SELECT patpid,rate,SType FROM tdp_ProviderAccomodationTariffPlan
--WHERE ('2012-12-27' BETWEEN @FromDate AND @ToDate) and fk_patid = 162 and fk_pacid = 36
FETCH NEXT FROM IDs into @ID,@FromDate,@ToDate
END
CLOSE IDs
DEALLOCATE IDs
在循环游标获取 id 为 '839' 的记录中,请帮我解决问题。