SET b.Com_introduce = a.company_intro --这里改改
FROM australia.dbo.companytest as a, yimingong.dbo.company as b
WHERE
(a.id = 2 AND b.Com_Id = 1) OR
(a.id = 14 AND b.Com_Id = 2) OR
(a.id = 18 AND b.Com_Id = 3) OR
(a.id = 5 AND b.Com_Id = 4) OR
(a.id = 16 AND b.Com_Id = 5) OR
(a.id = 18 AND b.Com_Id = 6) OR
(a.id = 15 AND b.Com_Id = 7) OR
(a.id = 4 AND b.Com_Id = 8) OR
(a.id = 3 AND b.Com_Id = 9) OR
(a.id = 12 AND b.Com_Id = 10) OR
(a.id = 6 AND b.Com_Id = 11) OR
(a.id = 8 AND b.Com_Id = 12) OR
(a.id = 11 AND b.Com_Id = 13) OR
(a.id = 10 AND b.Com_Id = 14) OR
(a.id = 9 AND b.Com_Id = 15) OR
(a.id = 7 AND b.Com_Id = 16) OR
(a.id = 19 AND b.Com_Id = 17) OR
(a.id = 20 AND b.Com_Id = 19) OR
(a.id = 21 AND b.Com_Id = 20) OR
(a.id = 22 AND b.Com_Id = 21)
sql 两个数据库之间怎么更新数据--<a href="" target="_blank" class="baidu-highlight">触发器</a>可以,通过数据库2中的表B更新数据库1中的表A。
create trigger tgr_update
on 数据库2.dbo.B
for update
as
begin
update 数据库1.dbo.A set 数据库1.dbo.A.字段='值' from inserted where 数据库1.dbo.A.字段=inserted.字段
end
Update是一个数据库SQL语法用语,用途是更新表中原有数据,单独使用时使用where匹配字段。
语法为:UPDATE 表名称 SET 列名称 = 新值 WHERE 列名称 = 某值
例如:Update table_name Set column_name = new_value Where column_name = some_value
扩展资料
update使用注意事项:
1、sp_updatestats可以更新统计信息到最新。
2、低内存会导致未被客户端连接的查询计划被清除。
3、修改表结构,修改索引后,查询计划会被清除,可以再修改后运行几遍查询。
4、使用update时候,order by 会影响查询速度,where中使用函数则会调用筛选器进行扫描,扫描表要尽量避免。
参考资料来源:百度百科—update
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)