日期:2014-05-18  浏览次数:20530 次

存储过程,HELP!!

create   proc   kinds
@acname   varchar(15),@aename   varchar(15),
@kcname   varchar(15),@kename   varchar(15)
as
insert   into   AllKinds   values(@acname,@aename);
create   table   @aename
(
KID   int   not   null   identity(1,1),
@kcname   varchar(15)   not   null,
@kename   varchar(15)   not   null
)
go
create   table   @kenane
(
DID   int   not   null   identity(1,1),
DCName   varchar(15)   not   null,
DImage   varchar(50),
DPrice   money   not   null
)
go
go

请问这个存储过程为什么不能让我用参数创建表和创建列?哪位好心的大虾能指点一二?多谢了!

------解决方案--------------------
create proc kinds @acname varchar(15),@aename varchar(15),
@kcname varchar(15),@kename varchar(15)
as
insert into AllKinds values(@acname,@aename)
exec( 'create table '+@aename+ '
(
KID int not null identity(1,1),
@kcname varchar(15) not null,
@kename varchar(15) not null
) ')

exec( 'create table '+@kename+ '
(
DID int not null identity(1,1),
DCName varchar(15) not null,
DImage varchar(50),
DPrice money not null
) ')