SQLServer复制表结构复制表数据
1:复制表结构select * into 数据库1.dbo.table1 from 数据库2.dbo.table2 where (1=2)2:复制表(包括结构和数据)select * into 数据库1.dbo.table1 from 数据库2.dbo.table2 where (1=1)3.从一个表中分组统计信息,插入新表中 select productcode,count(*) as quantity? into tempquantity from inventorylocation? where grade='3' and del='0' and booknumber like '02%' and productcode like '9787%' and locationnumber is not null ?group by productcode ? 4 ,把一个表中的数据更新到另外一个表中是sql。 update?? inventoryinfo? set?? inventoryinfo.quantity?? =? tempquantity.quantity ? from? inventoryinfo?? inner?? join??? tempquantity????? ? on?? inventoryinfo.productcode?? =?? tempquantity.productcode? where grade='3' and inventoryinfo.quantity>tempquantity.quantity (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |