测试数据
create table tb(c1 int)
insert tb select 1
union all select 2
union all select 3
union all select 4
union all select 5create table #t1(c1 int)create table #t2(c1 int)我现在需要的是想查询出ta 的数据,然后一次性插入到#t1,#t2两个临时表中
请问怎么做呢
create table tb(c1 int)
insert tb select 1
union all select 2
union all select 3
union all select 4
union all select 5create table #t1(c1 int)create table #t2(c1 int)我现在需要的是想查询出ta 的数据,然后一次性插入到#t1,#t2两个临时表中
请问怎么做呢
解决方案 »
- sql cursor 问题
- SQLServer2008Express可以用于商业么
- 请教 求前N行合计值的SQL 语句怎么写?
- 求一个表中的第91条到100条数据的最有效率的sql语句
- 急!!但是很简单的问题,关于Microsoft SQL Server Management Studio
- DBCC CHECKTABLE()如何使用?
- 如何合并结果集
- 如何通过sql语句建立作业?如何在应用程序中执行sql批处理?
- 如何访问SQLServer日志。我想知道数据库中表的记录一段时间的更改情况
- 小弟急!关于SQL 2000 安装是的问题。
- sql查询题,求助中......
- 如何通过发现结果作为字段名称?
我现在的目的是要把select的结果一次性插入到两张表中去
create trigger tri_t1
for insert
on t1
as
insert t2 select * from inserted然后:
insert #t1 select * from tb
insert #t1 select * from tb
insert #t2 select * from tb然后提交
insert #t2 select * from tb直接执行这两句话,就是一次把数据插入到两个表里。
而不是象楼上的需要select两次出来
不知道行不
如果用两个select的话,速度句要慢了
所以想一次性插入到两个表里
大家帮忙想想看,有没有办法
create trigger tri_t1
for insert
on t1
as
insert t2 select * from inserted然后:
insert #t1 select * from tb
谢谢大家了
看来SQL里没有我想要的这种办法