日期:2014-05-20 浏览次数:21108 次
ALTER Proc BroadBand_GetReports
(
@CableID VarChar(200),
@WorkStationID INT,
@StartTime datetime,
@EndTime datetime
)
as
--BEGIN REPORT
--1. select data
select r.ID,
r.CableID,
r.SubCabelID,
r.ProductCode,
r.WorkStationID,
r.DataElementID,
r.DataElementValue,
r.CreateUser,
r.ChangeUser,
r.ChangeDate,
r.CreateDate,
r.ShiftID,
r.Category,
r.Property1,
r.Property2,
r.Property3,
r.Property4,
r.Property5,
w.WorkStationName + e.DataElementName AS element
into #tempnpi
from RoutingWorkstationDataElement r,
DataElement e,
WorkStation w
where r.DataElementID=e.DataElementID and r.WorkStationID = w.ID
and r.changeDate between '2012-07-10' AND '2012-07-12'
--2. summary multi times to only one
DECLARE @DataElementID INT, @DataElementValue Varchar(500)
DECLARE Element_Cursor CURSOR FOR
SELECT CableID, WorkStationID, DataElementID, DataElementValue from #tempnpi