workshop yearmonth waterqty waterexp
metallic 2006-01 2000 2300
metallic 2006-02 3000 3500
Powder 2006-01 1800 2000
要写一个存储过程
过程包括 workshop begmonth endmonth 三个变量,
当变量值为 metallic时可得到下表
Item 2006-01 2006-02
waterqty 2000 3000
waterexp 2300 3500
请教大家了!
------解决方案--------------------
我一共有9列类似于waterqty,[email protected],@s2...可以加很多,但是exec(@newstring)[email protected],
-------
忘了這裡了。
[email protected],直接這麼執行
exec( 'select a.* into ' + @tablename + ' from ( ' + @s1 + ' union all ' + @s2 + ') a '
)
這樣就不會受8000的限制了