把所有的处理都用动态sql执行,虽然不好,但也只有这样才能满足表名为变量
declare @table varchar(10),@str varchar(8000)
set @str='declare time_cur cursor for select distinct sdate from '+@table_name+' 
open time_cur ... deallocate time_cur'
exec(@str)