我有一个存储数据库详细信息的表格,例如Database_Name
,Database_status
等。在Database_status
列下,条目为“Active
”和“Inactive
“。我想将字符串”Active
“转换为”1
“并将”Inactive
“转换为”0
“
答案 0 :(得分:1)
update T
set Database_status = case Database_status when 'Active' then '1'
when 'Inactive' then '0'
end
where Database_status in ('Active','Inactive')