--存储过程中有问题,做如下修改
create proc proc_addtable
as
if exists(select * from sysobjects where id=object_id('newtable') and xtype='u')
begin
drop table newtable
end
create table newtable (i int,ii datetime)
IF EXISTS (SELECT 1 FROM SYSOBJECTS WHERE ID = OBJECT_ID(N'proc_addtable') AND OBJECTPROPERTY(ID,N'ISprocedure') = 1)
DROP procedure proc_addtable
go
create proc proc_addtable
as
if exists(select * from sysobjects where id=object_id('newtable') AND OBJECTPROPERTY(ID,N'IsUserTable') = 1)
drop table newtable
else
create table newtable (i int,ii datetime)
select * from newtable
drop table newtable--增加这句话就可以了
go
exec proc_addtable
create proc proc_addtable
as
if exists(select * from sysobjects where id=object_id('newtable') and xtype='u')
drop table newtable
else
create table newtable (i int,ii datetime)
select * from newtable