IF OBJECT_ID ('tempdb..#tmp_ssss') IS NOT NULL
BEGIN
DROP TABLE #tmp_ssss
END
select * into #tmp_ssss from (select * from TB_FUEL_KPI_MODEL where '2020-08-03' <= Date and Date<'2020-08-04')as tt
select * from #tmp_ssss
UPDATE #tmp_ssss set Date = SUBSTRING(Date,1,7)+'4'+SUBSTRING(Date,9,13)
select * from #tmp_ssss
DB에 현재 3일에 있는 데이터를 4일로 옮김
두자리일때는 substring을 6까지만 잘라줘야함
IF OBJECT_ID ('tempdb..#tmp_ssss') IS NOT NULL
BEGIN
DROP TABLE #tmp_ssss
END
select * into #tmp_ssss from (select * from TB_FUEL_KPI_MODEL where '2020-08-04' <= Date and Date<'2020-08-05')as tt
UPDATE #tmp_ssss set Date = SUBSTRING(Date,1,6)+'19'+SUBSTRING(Date,9,13)
insert into TB_FUEL_KPI_MODEL select * from #tmp_ssss
댓글 없음:
댓글 쓰기