select distinct
SUBSTRING(CONVERT(VARCHAR(MAX), invno),1,1) as invoiceno from MyTable
output
A
6
I
7
T
0
1
9
B
S
i need to remove 6 and 9 entries and i used the below query it is giving me the error
(Conversion failed when converting the varchar value 'T' to data type int.)
select * from Mytable
where SUBSTRING(CONVERT(VARCHAR(MAX), invno),1,1) not in (4,5)