Sql Server 字段值转换成SQL语句
各位大侠中午好.
小弟在做一个项目的时候遇到一个问题,我有一个表a,a表有一个字段exp,该字段的值大概如下:
case when left(t_ring.prod_type,3) = '单排滚' or left(t_ring.prod_type,3) = '单排球' or left(t_ring.prod_type,3) = '双列球' or left(t_ring.prod_type,3) = '球柱联' then 1 end
declare @sql1 varchar(2000),@t table(sub_ring_id int)selecr @sql1='select sub_ring_id from t_ring '+' where '+@proc_estimate+'=1'insert @t exec(@sql1)declare ring scroll cursor for select * from @t...
[解决办法]
动态字符串,只能用游标执行生成动态字符,我经常用