日期:2014-05-17 浏览次数:20496 次
select CIFNm,ContractNm,LoanBlankDate,PeriodNm,'PeriodMangeCharge' as RepayType,PeriodMangeCharge as RepayAmount, LoanBalance,TotalInterest,RemainInterest,RemainPeriod,IsAdvanceBlack,'0' as bk from InterestList ) AS a where convert(varchar(10),LoanBlankDate,120) =convert(varchar(10),@Date,120) and IsAdvanceBlack='False'
------解决方案--------------------
思维不要太跳跃
你想需要可变那就是参数,只是有时不传这个参数的时候用当前时间代替,那就是一个默认NULL的参数,在存储过程处理下参数,如果NULL用GETDATE()代替
CREATE PROC PR_TEST ( @DT DATETIME = NULL ) AS IF @DT IS NULL SET @DT = GETDATE() ... GO