这样存储

wuxiangfang 2006-09-29 12:57:06
我想实现下面的存储过程
1.查找表1中与表2中完成相同的数据
2.查找表1中想同的数据,将重复的数据删除

请问大家这样的存储过程要怎么写才可以实现上面的效果,谢谢了!!
...全文
102 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
wuxiangfang 2006-09-29
  • 打赏
  • 举报
回复
好象都不是很清楚

splory 2006-09-29
  • 打赏
  • 举报
回复
1.select * from 表1 a where exists(select 1 from 表2 where a.column1=column1 and column2=a.column2)

2.select distinct * into #Tmp from 表1
drop table 表1
select * into 表1 from #Tmp
drop table #Tmp
中国风 2006-09-29
  • 打赏
  • 举报
回复
用触发器
allright_flash 2006-09-29
  • 打赏
  • 举报
回复
create procedure ...........

as
begin
insert into 2
select * from 表1

select * from 表
where count(*)>2

delete from 表
where count(*)>2
..
end

34,587

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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