关于数据导入--急

blue_snow 2003-10-16 09:27:40
在sqlserver中有两个库dbA和dbB,dbA中包含表tablea,tableb,tablec,tabled
dbB中包含表tablea,tableb,这两个表的结构和dbA中的tablea,tableb是一样的
现在要求创建一个存储过程(带有一个参数@id)将数据库dbB中tablea,tableb表中字段id=@id的数据导入到dbA,应该怎么写?谢谢!
...全文
34 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
friendliu 2003-10-16
  • 打赏
  • 举报
回复
create proc procname
@id int
as
insert into dba..tablea select * from dbb..tablea where id=@id
insert into dba..tableb select * from dbb..tableb where id=@id
go
sdhdy 2003-10-16
  • 打赏
  • 举报
回复
create proc test
@id int
as
insert into dbA..tablea select * from dbB..tablea where id=@id
insert into dbA..tableb select * from dbB..tableb where id=@id
zjcxc 2003-10-16
  • 打赏
  • 举报
回复
create proc p_test @id int
as
insert into dbA..tablea select * from dbB..tablea where id=@id
insert into dbA..tableb select * from dbB..tableb where id=@id
go
pengdali 2003-10-16
  • 打赏
  • 举报
回复
create proc @id int
as
insert dba..tablea select * from dbb..tablea where id=@id
insert dba..tableb select * from dbb..tableb where id=@id
txlicenhe 2003-10-16
  • 打赏
  • 举报
回复
use dbB
go
create procedure test @id int
AS
insert dbA..tableA select * from tableA where id = @id
insert dbA..tableB select * from tableB where id = @id
go


/****** Usage:
exec test 10
********/

22,206

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server 疑难问题
社区管理员
  • 疑难问题社区
  • 尘觉
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧