티스토리 뷰

변경 사항 발생 후 MOD_DT 현재 시간으로 변경

해당 SQL 실행 후 sql_text 컬럼 내용 복사하여 실행

select
    t.*,
    c.*,
	concat(
		'ALTER TABLE ',
		c.TABLE_SCHEMA ,
		'.',
		c.TABLE_NAME ,
		' MODIFY COLUMN MOD_DT datetime DEFAULT current_timestamp() on update current_timestamp() NULL COMMENT ',
		'\'',
		c.column_comment,
		'\';'
	) as sql_text
from information_schema.TABLES t
inner join information_schema.`COLUMNS` c on c.TABLE_SCHEMA = t.TABLE_SCHEMA and c.TABLE_NAME = t.TABLE_NAME
where 1=1
and t.TABLE_TYPE = 'BASE TABLE'
and c.COLUMN_NAME = 'MOD_DT' /* update 되어야 하는 컬럼 */

 

 
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함