一、两个时间段之间的日期
SELECT dt= convert(varchar(10),dateadd(day,number,@rq1),23)
INTO #tmp_date FROM master.dbo.spt_values
WHERE type='P' and number <= datediff(day,@rq1,@rq2)
二、获得exec的结果
获得变量
declare @num int, @sqls nvarchar(4000) set @sqls='select @a=count(*) from tableName ' exec sp_executesql @sqls,N'@a int output',@num output select @num
获得临时表
insert into # exec(@runs) https://bbs.csdn.net/topics/340097859
三、负数转正数
select ABS(列名)from 表