I'm using this to match a phoneNumber that is 10 characters in lenth. Is there a cleaner way to write this?
select * from a where TelephoneNummber not like '[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
I'm using this to match a phoneNumber that is 10 characters in lenth. Is there a cleaner way to write this?
select * from a where TelephoneNummber not like '[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
No. If you look in the SQL Server Books On-Line (BOL) do a search for the term "[ ] (Wildcard - Character(s) to Match) (Transact-SQL)". It has an example almost exactly like your situation to help illustrate.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.