SQL字段取值

来源:百度知道 编辑:UC知道 时间:2024/05/15 19:09:55
比如说这个字段:【[205795;20595169]】,黑括号里的,符号也算。我只要取20595169怎么取啊?

例子:select * from a,b where a.字段(也就是:[205795;20595169])=b.字段(也就是:20595169)

那请问 a.字段 要怎么写呢?

exec('select * from a,b where a.'+205795;20595169+'=b.'+20595169+'
')

select replace(stuff(字段名,1,charindex(';',字段名),''),']','') from 表名

select * from a,b where a.substring(字段,8,8)=b.字段
如果字段类型是char或者vvarchar的情况下