Searching character in Specific Position - SQL Server

Asked

Viewed 187 times

0

Hello, can anyone help me? I am building a query and I came across some problems in the way the bank was structured. I have a base with several phone numbers, and I need the 5°digito to be = 9. I have done a LEN(Phone) = 14 to identify only cell phones, so simplifying I need to put in my Where to bring only where the 5th digit is 9

inserir a descrição da imagem aqui

1 answer

1


SELECT telefone,   
FROM 'Sua Tabela'
WHERE SUBSTRING(telefone, 5, 1) = 9;

I’m not sure if it will work because at the moment I don’t have my laptop.

  • Very good, it worked Matheus. Thank you very much.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.