Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
tarkusha
Starting Member
1 Post |
Posted - 2012-01-14 : 04:43:50
|
Dear expert,Insert SQL server job condition Below is checking max date in SCADA_HDATA table which is 15-Oct-2011 and it suppose to be four days prayer to sysdate ,the job is failed because it retrieving huge amount of data, I would like to change the where condition to get sysdate instate of max(time) from [SCADA].[DBO].[SCADA_HDATA] ) to minimize amount of data retrieved ,please any one can helpOn writing the syntax base on the syntax below.where--time between cast( convert(varchar, getdate()-1, 101)+' 06:00:00.000' as datetime) and cast( convert(varchar, getdate(), 101)+' 06:00:00.000' as datetime)timebetween (select max(time) from [SCADA].[DBO].[SCADA_HDATA] ) andgetdate()-1/24 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-01-14 : 04:56:15
|
[code]...wheretime > = dateadd(dd,datediff(dd,0,getdate()),0)and time < dateadd(dd,datediff(dd,0,getdate()),1)[/code]------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
|
|
|
|
|