简单问题,导入数据 Insert into TAB_A(B,C) select a,b,c from TAB_B 假如A 为自动增长的列! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 insert into data1.dbo.tb1(字段)select 字段 from data2.dbo.tb2 insert into 另一数据库名..表名(AutoID) select 字段名 from 表名 是标识列?那就改一下:set identity_insert 另一数据库名..表名 ongoinsert 另一数据库名..表名 (AutoID) --字段一定要填写select 字段名 from 表名goset identity_insert 另一数据库名..表名 off set identity_insert data1.dbo.tb1 oninsert into data1.dbo.tb1(字段)select 字段 from data2.dbo.tb2set identity_insert data1.dbo.tb1 off 或者你在另一个数据库中运行:set identity_insert 表名 ongoinsert 表名 (AutoID) --字段一定要填写select 字段名 from 源数据库名..表名goset identity_insert 表名 off sql 多行拼接成一行 计算采购平均价的算法,应采用什么计算方法? 简单的sql问题,可是我不会,大家帮帮我好吗? 怎么给已有的SQL语句用程序添加查询条件 SQL 2000 在一个字段里面换行? 看看我的SQLServer删除型触发器怎么不行呢? @@rowcount死循环了... 求助一条SQL语句!急!!! 附加数据库错误 这个sql命令怎么写? 请问,如何在存储过程里调用bcp命令! 请问如何在触发器中更新远程SQL Server数据库中的数据
select 字段 from data2.dbo.tb2
那就改一下:
set identity_insert 另一数据库名..表名 on
go
insert 另一数据库名..表名 (AutoID) --字段一定要填写
select 字段名 from 表名
go
set identity_insert 另一数据库名..表名 off
insert into data1.dbo.tb1(字段)
select 字段 from data2.dbo.tb2
set identity_insert data1.dbo.tb1 off
set identity_insert 表名 on
go
insert 表名 (AutoID) --字段一定要填写
select 字段名 from 源数据库名..表名
go
set identity_insert 表名 off