用存储过程创建表,表名有输入变量确定,请问高手........
我写了一个过程
但是检查时出错,请帮忙改正,或给一个新的过程,谢谢了。
代码如下:
CREATE PROCEDURE tianjia
( @biaoming varchar(20)=null,
@cheming varchar(20)=null output)
AS
create table @biaoming
( mingcheng varchar(20),
bianhao varchar(20),
danjia varchar(20),
jiezhang varchar(20),
leibian varchar(20),
xiaoliang varchar(20),
tupian varchar(50)
)
@cheming=@biaoming
return
------解决方案----------------------
CREATE PROCEDURE tianjia
(
@biaoming varchar(20)=null,
@cheming varchar(20)=null output
)
AS
exec( '
create table [ '+@biaoming+ ']
( mingcheng varchar(20),
bianhao varchar(20),
danjia varchar(20),
jiezhang varchar(20),
leibian varchar(20),
xiaoliang varchar(20),
tupian varchar(50)
)
')
set @cheming=@biaoming
go
--
declare @re varchar(20)
exec tianjia 'AA ', @re output
select @re
select * from AA