请问各位,我怎样列出substring(PSty,2,patindex('%*%',PSty)-2)截取出错的记录?

finer 2005-07-15 10:20:37
select PSty from basedata where PSty like 'T%' and substring(PSty,2,patindex('%*%',PSty)-2)<=convert(dec(10,2),9)
请问各位,我怎样列出substring(PSty,2,patindex('%*%',PSty)-2)截取出错的记录?
如PSty='TU35'因为没“*”号而出错,或其它异常的记录。

我的表中PSty记录是像下面这样的一些记录(字段是PSty):
T3.05*1.5*2.06
T3.05*1.5*2.06
T10*5*5
T10*5*5
T10*5*5
T10*5*5
T10*5*5
T10*5*5
T22*14*6.5
T22*14*6.5
T22*14*6.5
T22*14*6.5
T22*14*6.5
T22*14*6.5
TU35
ET20
ET20
ET20
ET20
...
...全文
165 2 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
finer 2005-07-15
  • 打赏
  • 举报
回复
公子,这个怎么不行:
select PSty from basedata where not exist

select PSty from basedata where PSty like 'T%' and substring(PSty,2,patindex('%*%',PSty)-2)<=convert(dec(10,2),9)
子陌红尘 2005-07-15
  • 打赏
  • 举报
回复
select
PSty
from
basedata
where
PSty like 'T%'
and
(charindex('*',PSty) =0
or
isnumeric(substring(PSty,2,patindex('%*%',PSty)-2))=0)

27,581

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server 应用实例
社区管理员
  • 应用实例社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧