22,209
社区成员
发帖
与我相关
我的任务
分享
insert into dbo.T_DATA_MeanConcentration
select fd_sectionID,@startDate,@endDate,@sectionType,1,@createDate,null,null,null,null,null,
dbo.T_fn_d1_Decimal(avg(convert(float,dbo.T_fn_0_LimtValue(fd_value1,2))),@v1),
dbo.T_fn_d1_Decimal(avg(convert(float,dbo.T_fn_0_LimtValue(fd_value2,2))),@v2),
dbo.T_fn_d1_Decimal(avg(convert(float,dbo.T_fn_0_LimtValue(fd_value3,2))),@v3),
dbo.T_fn_d1_Decimal(avg(convert(float,dbo.T_fn_0_LimtValue(fd_value4,2))),@v4),
dbo.T_fn_d1_Decimal(avg(convert(float,dbo.T_fn_0_LimtValue(fd_value5,2))),@v5)
MAX(sdi_showSectionName),MAX(sdi_showRiverName),MAX(sdi_showRiverCode),MAX(sdi_showWaterArea),
MAX(sdi_showAssessmentCity),MAX(sdi_showAssessmentCityCode),MAX(sdi_showMonitorCity),
MAX(sdi_showMonitorCityCode),MAX(sdi_showStationName),MAX(sdi_showStationCode),MAX(sdi_sectionOrderby)
from dbo.T_DATA_BasicDataApply x
left join (select sdi_sectionType,sdi_sectionID,sdi_month,sdi_year,sdi_showStationName,sdi_showStationCode,
sdi_showSectionName,sdi_showRiverName,sdi_showRiverCode,sdi_showWaterArea,sdi_showAssessmentCity,
sdi_showAssessmentCityCode,sdi_showMonitorCity,sdi_showMonitorCityCode,sdi_sectionOrderby
from dbo.T_SYS_SectionDetailInfo
where sdi_sectionType=@sectionType
and sdi_year+'-'+sdi_month=@endDate) y
on x.fd_sectionID=y.sdi_sectionID and x.fd_year=y.sdi_year
and x.fd_month=y.sdi_month and x.fd_sectionType=y.sdi_sectionType
where fd_sectionType=@sectionType
and fd_year+'-'+fd_month between @startDate and @endDate
group by fd_sectionID
set @intErrorCode=@@error
触发器部分:
select
@sectionType=mc_sectionType,
@startDate=mc_startDate,
@endDate=mc_endDate,
@sectionAttr=mc_sectionAttr
from inserted x
插入的过程中 需要从 inserted 表中获取 状态值 mc_sectionAttr,想问下,这样获取 mc_sectionAttr 值,是每条的值,还是整体的值?