日期:2014-05-18  浏览次数:20467 次

新手,求一存储过程
刚开始学数据库~~求一核查数据的存储过程,请大家多多帮忙~~~^_^


查询表1中的id号是否在表2中。
  是的显示出该id。不是的结束此过程

------解决方案--------------------
select a.id from table1 a,table2 b where a.id=b.id
------解决方案--------------------
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: Fsolsh)Andy
-- Create date: 2007/09/30
-- =============================================
ALTER PROCEDURE [OWER].[YOUR_PROCEDURE_NAME]
AS
BEGIN
SELECT A.ID FROM TABLE1 A, TABLE2 B WHERE A.ID = B.ID
END
GO

SET ANSI_NULLS OFF
GO
SET QUOTED_IDENTIFIER OFF
GO