如何传递存储过程参数??????请帮看以下东东啊(50分)

  • 主题发起人 主题发起人 ddynet
  • 开始时间 开始时间
D

ddynet

Unregistered / Unconfirmed
GUEST, unregistred user!
CREATE procedure TableExists (@tablename varchar(20))
As
if exists (select * from tempdb.dbo.sysobjects where id = object_id('tempdb..'+@tablename))
execute ('drop table @tablename')
GO
最后一句有错误!!!!!怎么改????????????????
 
CREATE procedure TableExists (@tablename varchar(20))
As
declare @s1 varchar(100)
if exists (select * from tempdb.dbo.sysobjects where id = object_id('tempdb..'+@tablename))
begin
set @s1 = 'drop table' + @tablename
execute @s1
end
GO
 
接受答案了.
 

Similar threads

后退
顶部