Hi,
if you want to insert then use..
insert into tablename
select [EMPID],[CHECKTIME]
,case when datepart(HOUR,[CHECKTIME])>7 and datepart(HOUR,[CHECKTIME]) < 12 then 10 when datepart(HOUR,[CHECKTIME])>12 then 20 else [cost] end as [cost]
,case when datepart(HOUR,[CHECKTIME])>7 and datepart(HOUR,[CHECKTIME])< 12 then 20 when datepart(HOUR,[CHECKTIME])>12 then 30 else [company pass] end as [company pass]
,case when datepart(HOUR,[CHECKTIME])>7 and datepart(HOUR,[CHECKTIME]) < 12 then 30 when datepart(HOUR,[CHECKTIME])>12 then 50 else [Total ] end as [Total ]
from checkinout
and if you need to update
update checkinout
set cost= case when datepart(HOUR,[CHECKTIME])>7 and datepart(HOUR,[CHECKTIME]) < 12 then 10 when datepart(HOUR,[CHECKTIME])>12 then 20 else [cost] end
,[companypass]=case when datepart(HOUR,[CHECKTIME])>7 and datepart(HOUR,[CHECKTIME])< 12 then 20 when datepart(HOUR,[CHECKTIME])>12 then 30 else [company pass] end
,[Total]=case when datepart(HOUR,[CHECKTIME])>7 and datepart(HOUR,[CHECKTIME]) < 12 then 30 when datepart(HOUR,[CHECKTIME])>12 then 50 [Total ] end