TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
nitish rai
NA
319
18.7k
two select common used in store procedure but result is one
Jan 5 2018 1:50 AM
ALTER Proc [dbo].[ProCreateBottleline1POSIMATfinal]
(
@StartDate date,
@EndDate Date
)
As
begin
select * from FloatTable
where cast(DateAndTime as date) between @StartDate and @EndDate
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
End
-----------------exec ProCreateBottleline1POSIMATfinal @StartDate='2018-01-04',@EndDate='2018-01-05'
Reply
Answers (
2
)
What is the real use of Sql cursor ?
Get the Date time between two dates.