批量插入更新的 sql语句

--备份一个表中得数据到另外一张表 (表不存在)

select * into [Northwind].[dbo].abc
FROM [Northwind].[dbo].[Categories]

--批量插入(表存在)

insert into [Northwind].[dbo].abc
(CategoryName,[Description],Picture)
select CategoryName,[Description],Picture FROM [Northwind].[dbo].[Categories]

--批量更新
update [Northwind].[dbo].abc
set abc.CategoryName = LEFT( [Categories].CategoryName,10)
from [Northwind].[dbo].[Categories]
where abc.CategoryID = [Categories].CategoryID

--删除
delete from [Northwind].[dbo].abc
where abc.CategoryID in (select CategoryID from [Categories] )

--删除表
drop table [Northwind].[dbo].abc

原文地址:https://www.cnblogs.com/xl711436/p/2292128.html