Wednesday, June 17, 2015

design pattern

http://www.oodesign.com/
https://sourcemaking.com/design_patterns

Friday, June 5, 2015

Datediff in sql in hour minute second

insert into [DBL_Group].[dbo].[tblGmMachineZeroHour]( fldDate,                  fldOrderNo,     fldUnit,   [fldLine], fldMachineName, fldMachineQty,fldReasonKey,fldFrom,   [fldTo],   fldTotalTime,[fldReason])
SELECT
     Cast( fldDate  as Date),  [fldOrderNo],   [fldUnit],    [fldLine],[fldMachineName],[fldMachineQty],[fldReasonKey], [StartProblem],[Confirmation],
     CAST(DATEADD(MINUTE,DATEDIFF(MINUTE,[StartProblem],[Confirmation]),'1900-01-01 00:00:00.000') AS Datetime)   ,
    
     [fldReason]   
    
  FROM [DBL_Group].[dbo].[tblGmMachineZeroHourTest]   where [StartProblem] is not null and  [Confirmation] is not null
  and  DATEDIFF(Day,[StartProblem],[Confirmation])<1 and fldReasonKey is not null