1、查询数据,赋值给变量
-- 手工报送成功
BEGIN
declare @rptbatch varchar(64)
declare @status varchar(2)
set @status = 92 --修改状态
select @rptbatch = rptbatch from sysconfig; --查询数据赋值给变量
update sysconfig set status = @status where 1=1;
update reportprocess set status=@status where rptbatch = @rptbatch;
update formsprocess set status=@status where rptbatch = @rptbatch;
select * from sysconfig;
END
2、给某时间列赋予任意时间值
declare @date_start datetime
declare @date_end datetime
set @date_start= '2020-06-01'
set @date_end=getdate()
update USER_LOG set OCCUR_TIME = dateadd(minute,abs(checksum(newid()))%(datediff(minute,@date_start,@date_end)+1),@date_start) where 1=1