將時間轉換成數字,把數字轉換成時間,均勻取必定時間間隔(好比每91秒取一條記錄)內的符合條件的記錄ip
/****** Script for SelectTopNRows command from SSMS ******/
SELECT [id]
,[tagDate],CAST(tagdate as float)*10000000000 as numdate
,[HZ105_315HH]
,[HZ105_DO315AI]
,[HZ105_FI315AI]
,[HZ105_PH315AI]
,[HZ105_PI315AI]
,[HZ105_TI315AI]
,[HZ105_WI315AI]
,[HZ105_ZS315AI]
FROM [IhHisdata].[dbo].[dat_hisdata]
where CAST( CAST(tagdate as float)*10000000000 as decimal)%91=0 --10000000000是爲了將浮點轉換成整數,便於取模
將時間轉換成數字,把數字轉換成時間
select GETDATE() as t, CAST('2014-11-15 15:44:08.470' as datetime) as tt, CAST(41956.655653588 as datetime)ci