简体   繁体   English

格式化的 T-SQL 过滤器

[英]T-SQL Filter on formatting

I have a ref no.我有一个参考号。 column that includes all types of formatting.列,包括所有类型的格式。 I'd like to include only ref.no that have a format of xx-xxxx.我只想包含格式为 xx-xxxx 的 ref.no。 I currently have我目前有

inv.ReferenceNumber LIKE '%-%' inv.ReferenceNumber LIKE '%-%'

However, I have Ref No.'s with formats x-xxxxx and xxxxx-xx.但是,我有格式为 x-xxxxx 和 xxxxx-xx 的参考编号。 Is there a way where I can filter having results as xx-xxxx?有没有办法过滤结果为 xx-xxxx?

Underscore matches exactly one character.下划线正好匹配一个字符。

So所以

where inv.ReferenceNumber LIKE '__-____'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM