这个存储过程为什么报错说变量没有声明 麻烦哪位看一下
create procedure tmp_cp as
declare @FromTableName varchar(20),
@ToTableName varchar(30)
declare Cur_Tab CURSOR for select [name] from sysobjects where type='u' and [name] like 'z_tab%' order by [name]
open Cur_tab
FETCH Cur_tab into @FromTableName
WHILE @@FETCH_STATUS=0
BEGIN
set @ToTableName='ygcwdb.dbo.'+ @FromTableName
INSERT INTO @ToTableName values (select * from @FromTableName)
FETCH Cur_tab into @FromTableName
END
CLOSE Cur_tab
DEALLOCATE Cur_tab
return
GO