1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
USE tempdb
go
create table T1(col1 char(5) NOT NULL, col2 int NOT NULL)
go
insert T1 values('John',1)
insert T1 values('John',1)
insert T1 values('JOhn',1)
insert T1 values('JOhn',1)
insert T1 values('JoHn',1)
insert T1 values('JoHn',1)
insert T1 values('John',1)
insert T1 values('JohN',1)
insert T1 values('JohN',1)
insert T1 values('john',1)
insert T1 values('john',1)
insert T1 values('john',1)
go
DECLARE @var char(5)
SET @var = 'john '
SELECT *
from T1
where CONVERT(binary(5),col1)=CONVERT(binary(5),@var) |
Partager