Experts,
CREATE TABLE [dbo].[TimeStats] ( [TimingStatsID] [int] IDENTITY(1,1) NOT NULL, [TimingObject] [varchar](50) NOT NULL, [TimingStep] [int] NULL, [TimingBatch] [uniqueidentifier] NOT NULL, [Time] [datetime] NOT NULL ) INSERT INTO [dbo].[TimeStats] VALUES ( 'gpmp', 1, '492939F4-611B-4BBC-9DF4-142F4AB774D9', '2014-02-07 13:56:56.533' ) INSERT INTO [dbo].[TimeStats] VALUES ( 'gpmp', 2, '492939F4-611B-4BBC-9DF4-142F4AB774D9', '2014-02-07 13:56:58.770' ) INSERT INTO [dbo].[TimeStats] VALUES ( 'gpmp', 3, '492939F4-611B-4BBC-9DF4-142F4AB774D9', '2014-02-07 13:57:01.420' ) INSERT INTO [dbo].[TimeStats] VALUES ( 'gpmp', 1, '95853BD6-7B77-4142-8E43-F4C528B67AF3', '2014-02-07 16:29:14.067' ) INSERT INTO [dbo].[TimeStats] VALUES ( 'gpmp', 2, '95853BD6-7B77-4142-8E43-F4C528B67AF3', '2014-02-07 16:29:14.640' ) INSERT INTO [dbo].[TimeStats] VALUES ( 'gpmp', 3, '95853BD6-7B77-4142-8E43-F4C528B67AF3', '2014-02-07 16:29:15.287' ) SELECT * --, (TimingStep2 - TimingStep1 for each TimingBatch value) AS 'MS' FROM [dbo].[TimeStats] ORDER BY [TimingStep], [Time] SELECT '1' AS 'TimingStatsID', 'gpmp' AS 'TimingObject', '1' AS 'TimingStep', '492939F4-611B-4BBC-9DF4-142F4AB774D9' AS 'TimingBatch', '2014-02-07 13:56:56.533' AS 'Time', '2014-02-07 13:56:58.770 - 2014-02-07 13:56:56.533' AS 'Ms' UNION ALL SELECT '4' AS 'TimingStatsID', 'gpmp' AS 'TimingObject', '1' AS 'TimingStep', '95853BD6-7B77-4142-8E43-F4C528B67AF3' AS 'TimingBatch', '2014-02-07 16:29:14.067' AS 'Time', '' AS 'Ms' UNION ALL SELECT '2' AS 'TimingStatsID', 'gpmp' AS 'TimingObject', '2' AS 'TimingStep', '492939F4-611B-4BBC-9DF4-142F4AB774D9' AS 'TimingBatch', '2014-02-07 13:56:58.770' AS 'Time', NULL AS 'Ms' DROP TABLE [dbo].[TimeStats]
Can anybody please help me out?
Thank You
Regards,
Kumar
Please do let us know your feedback. Thank You - KG, MCTS