开发者

SQL Server Query Command

I have an SQL database table, I want to find everything in a table where the 'Room' says 'DISPOSED', Insert 'DISPOSED' into the 'Status' field and then delete the entry in 'R开发者_JAVA技巧oom'.

Basically moving the entry from one field to another (if the 'Room' field has 'DISPOSED' in it)

Hope this makes sense.

Thanks for any help.


Update table_name SET room='', Stauts='DISPOSED' where Room='DISPOSED'

OR

Update table_name SET room=null, Stauts='DISPOSED' where Room='DISPOSED'


The SQL is

UPDATE table SET status = room, room = null WHERE room = 'DISPOSED'

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜