sql server - SQL Query to return any computer with the 7th character is a D -
here's have it's returning computers 7th character not d
select * vcomputer [os name] '%server%' , left(name, 7) '%d%' here returns...
chbdytpt2k8v3vm chbdysprmsapp01 chbdysppamapp05 chbdysplncweb02 chbdystmssweb02 chbdysrqpmdbs01 sdfax01 oldcomsopproddb chbdyspextadc99 chbdyspvrxmas01 capadbdev1 chbdystodmapp98 chbdyspmsvweb04 chbdysppamweb01 ussumsdobictx01 ussumsdvradbs03
what you're doing getting first 7 characters (left(name, 7)) , checking see if of characters "d" (like '%d%').
to check 7th character, substring great tool:
substring([name],7,1)='d'
Comments
Post a Comment