i have a column in my sql table that holds the value 'Yes' and 'No'
im copying the table into a new database where the data type of that column has changed from nchar(3) to tinyint
is there a way to select those particular field as numeric into the new table??
eg where 'yes' => 1 and where 'No' => 0
One way to do it would be using case
select case when col = 'yes'
then 1
else 0
end as new_col_value
from your_table
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.