动态语句中赋值方法
declare @yearmaxvalue decimal(15,4);
set @yearmaxvalue = 0;
set @csSql = 'select @yearmaxvalue = max(_value) from '+ @HisName+ '
where dataitemid = '+convert(varchar,@itemid)+' and year(_time) = '+convert(varchar,@yearindex);
exec sp_executesql @csSql,N'@yearmaxvalue decimal(15,4) out',@yearmaxvalue out
这样就会将最小值赋值到@yearmaxvalue 变量中
动态语句中赋值方法
最新推荐文章于 2023-07-10 14:33:34 发布