搜索字段中的特定位置

问题描述 投票:-3回答:1

我的ID字段长度为11个字符,长度为123456789abc

  1. 如何检查长度
  2. 如何检查位置3以确保它是数字

从表中选择*其中ID =位置2必须为'A-Z'

sql sql-server
1个回答
0
投票
您可以将like与图案一起使用。像这样的东西:

Select * from table where id like '___[0-9]%' and len(id) = @length

© www.soinside.com 2019 - 2024. All rights reserved.