简体   繁体   中英

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. I currently have

inv.ReferenceNumber LIKE '%-%'

However, I have Ref No.'s with formats x-xxxxx and xxxxx-xx. Is there a way where I can filter having results as xx-xxxx?

Underscore matches exactly one character.

So

where inv.ReferenceNumber LIKE '__-____'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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