跳至主要內容

超期天数

五六零网校小于 1 分钟

代码示例

T0.[TaxDate],
	  datediff(d, T0.[TaxDate], GetDate()) AS '超期日期',
	  CASE WHEN  (
		datediff(d, T0.[TaxDate], GetDate())
	) > 0  THEN  '超' + ' ' +   CAST (
		(
			datediff(d, T0.[TaxDate], GetDate())
		) AS nvarchar
	)   + '天'  
WHEN (
	datediff(d, T0.[TaxDate], GetDate())
) < 0  THEN
	'剩' + ' ' + CAST (
		(
			datediff(d, GetDate(), T0.[TaxDate])
		) AS nvarchar
	) + '天'
END AS '超期'