1
Reply

Please get the solution on top priority

nitish rai

nitish rai

Jan 18 2018 6:10 AM
166
ALTER Proc [dbo].[ProCreateBottleline1POSIMATfinal]
@StartDate varchar(50)=null,
@EndDate varchar(50)=null
As
begin
SELECT [0]as [ActivePowerKW],[3]as [PowerFactor],[1]as [CurrentAmp] ,[4] as [VoltageV],[2]as [FrequencyHz],DateAndTime FROM
(
SELECT TagIndex,Val,DateAndTime,Row_Number() Over(partition by TagIndex order by TagIndex,DateAndTime ) As ColumnSeries FROM FloatTable
)Temp
Pivot
(
max(Val) For TagIndex in ([0],[3],[1],[4],[2])
)Piv
select * from FloatTable
where cast(DateAndTime as date) between @StartDate and @EndDate
End
--------exec ProCreateBottleline1POSIMATfinal @StartDate='2018-01-04 16:28:08.000',@EndDate='2018-01-15 16:28:08.000'

Upload Source Code  Select only zip and rar file.
Answers (1)