服务器: 消息 156,级别 15,状态 1,过程 update_t,行 9
在关键字 'trigger' 附近有语法错误。
服务器: 消息 170,级别 15,状态 1,过程 update_t,行 34
第 34 行: 'sz_taxkind' 附近有语法错误。
在关键字 'trigger' 附近有语法错误。
服务器: 消息 170,级别 15,状态 1,过程 update_t,行 34
第 34 行: 'sz_taxkind' 附近有语法错误。
set @s=''
select @s=@s+',['+col_s+']=0' from sk.jgx.dbo.sz_taxkind1 where checked='1'group by col_s
set @s=substring(@s,2,8000)
exec('update sz_taxkind set '+@s+' where account='''+@account+'''')这段语句可以作为触发器里面的语句不?就是说触发器被触发后,执行上面的操作!
select @s=''
select @s=@s+',['+col_s+']=0' from sk.jgx.dbo.sz_taxkind1 where checked='1' group by col_s
select aa =substring(@s,2,8000)
--exec('update sz_taxkind set '+@s+' where account=''10004303''')
end
--这个aa只能返回一条记录,邹大侠试试!不知道原因,,在同一个数据库内是可以 返回多条符合条件的记录的!
select @s=''
select top 100 percent @s=@s+',['+col_s+']=0' from sk.jgx.dbo.sz_taxkind1 where checked='1' group by col_s
select aa =substring(@s,2,8000)
--exec('update sz_taxkind set '+@s+' where account=''10004303''')
end
select @s=''
select top 100 percent --这里加上
@s=@s+',['+col_s+']=0' from(select distinct col_s from sk.jgx.dbo.sz_taxkind1 where checked='1')aselect aa =substring(@s,2,8000)
--exec('update sz_taxkind set '+@s+' where account=''10004303''')
end