Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL Server : select statement where value have format

I'm trying to find special string that has a format like ##-%, start from two character and '-'

select * 
from temp 
where name like '##-%'

Give me some advice, or example how I can get this?

And how can I replace this format on empty string ""

like image 742
AleksP Avatar asked May 02 '26 15:05

AleksP


1 Answers

If would you find the special character which is start from two character and '-'

select * from temp where name like '[a-z][a-z]-%'

if would you want to find the special string have format like '##-%

select * from temp where name like '##-[%]%'

If would you want to find the third letter is '-'

select * from temp where name like '__-%'
like image 194
user3864233 Avatar answered May 05 '26 07:05

user3864233



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!