if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[CheckDetailMain]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[CheckDetailMain] GOCREATE PROCEDURE [dbo].[CheckDetailMain] @UseID Varchar(10) AS begin ..... end
if not exists (select 1 from sysobjects a,syscolumns b where a.id = b.id and a.xtype = 'u' and a.name = tablename and b.name = columnname) begin --如果没有的话endif not exists (select 1 from sysobjects where xtype = 'p' and name = pname) begin --如果没有 end
drop procedure [dbo].[CheckDetailMain]
GOCREATE PROCEDURE [dbo].[CheckDetailMain] @UseID Varchar(10)
AS
begin
.....
end
begin
--如果没有的话endif not exists (select 1 from sysobjects where xtype = 'p' and name = pname)
begin
--如果没有
end