TSQL - 我在这里更新了什么?

时间:2015-01-28 01:12:28

标签: sql-server

update outbound.notification
set statuscode = 1
select * from outbound.Notification
where statuscode = 4 --not in (3,6) 
and convert(varchar,createdtimestamp,102) > '2015.01.10'
and OutboundID <> 647

执行上述查询。意思是将选择注释掉,以便我可以在选择该状态的查询和更新它们之间交替。我对哪些行做了什么?

1 个答案:

答案 0 :(得分:3)

您更新了outbound.Notification的所有行。您的查询通常是两个单独的查询。

首先,这会更新outbound.Notification的所有行:

update outbound.notification set statuscode = 1

其次,这只是一个SELECT声明。

select * from outbound.Notification
where statuscode = 4 --not in (3,6) 
and convert(varchar,createdtimestamp,102) > '2015.01.10'
and OutboundID <> 647