declare
@txt char(1024)
set @txt = 'if exists (select * from dbo.sysobjects where id = object_id(N "[dbo].[cmd] ") and OBJECTPROPERTY(id, N "IsProcedure ") = 1) ' +
' begin ' +
' DROP PROCEDURE [dbo].[cmd] ' +
' print "cmd sproc exist, drop it " ' +
' end '
exec @txt
------解决方案--------------------
declare
@txt char(1024)
set @txt = 'if exists (select * from dbo.sysobjects where id = object_id(N ' '[dbo].[cmd] ' ') and OBJECTPROPERTY(id, N ' 'IsProcedure ' ') = 1) ' +
' begin ' +
' DROP PROCEDURE [dbo].[cmd] ' +
' print ' 'cmd sproc exist, drop it ' ' ' +
' end '
exec(@txt)
------解决方案--------------------
declare
@txt char(1024)
set @txt = 'if exists (select * from dbo.sysobjects where id = object_id(N ' '[dbo].[cmd] ' ') and OBJECTPROPERTY(id, N ' 'IsProcedure ' ') = 1) ' +
' begin ' +
' DROP PROCEDURE [dbo].[cmd] ' +
' print ' 'cmd sproc exist, drop it ' ' ' +
' end '
exec @txt