case sensitive join in SQL Server
To do case sensitive join in T SQL we have to use "COLLATE Latin1_General_CS_AS".
Suppose you want to get the results where name is 'Ramesh' but not 'ramesh' than use below query.
CREATE TABLE #temp( id int, name varchar(100))
INSERT INTO #temp(id,name) values(1,'RAMESH')
INSERT INTO #temp(id,name) values(2,'Ramesh')
INSERT INTO #temp(id,name) values(3,'ramesh')
select * from #temp where name COLLATE Latin1_General_CS_AS ='Ramesh'
No comments:
Post a Comment