语句1执行目的:
insert deptstock select @year,@month from stock0101 where deptno=@deptno
请问语句1该如何写?
//由于@year ,@month是int类型
insert deptstock select @year,@month from stock0101 where deptno=@deptno
请问语句1该如何写?
//由于@year ,@month是int类型
exec('insert deptstock Select '''+@year +''','''+@Month+''',* from Stock'+@deptno+' where deptno='''+@deptno+'''')
select @strexec='insert deptstock Select '+cast(@year as char(4)) +','+cast(@Month as char(2))+',* from Stock'+@deptno+' where deptno="'+@deptno+'"'exec(@strexec)