2013-04-25 49 views

回答

0

對於SQL Server

update tbl 
SET DESC = CASE 
    WHEN DESC= 'Male' THEN 'Female' 
    WHEN DESC = 'Female' THEN 'Male' 
    ELSE DESC   
    END 
0

是的,你可以這樣做,使用情況下聲明

UPDATE TABLE 
SET DESC = CASE WHEN DESC = 'MALE' THEN 'Female' WHEN DESC = 'Female' THEN 'MALE' ELSE DESC END 
2

試試這個

UPDATE Table 
SET DESC = CASE 
    WHEN DESC= 'Male' THEN 'Female' 
    WHEN DESC = 'Female' THEN 'Male' 
    ELSE DESC   
    END 

出把儘可能遵循

ID DESC 

1  Female 
2  Female 
3  Female 
4  Male 
5  Male 
6  Male 
7  Male 
相關問題