Monday, January 23, 2017

Check Case-Sensitivity in SQL Server

In this article I am going to explain how to Check Case-Sensitivity in SQL Server.


Description:
SQL server determines case sensitivity by collation. COLLATE is the T-SQL clause used to specify a particular collation for an expression. We can use this to validate the users enter password at the time of login.

Syntax
select * from tablename where column_name='string' COLLATE SQL_Latin1_General_CP1_CS_AS

Example:
Create table #test
(
id int,
name varchar(50)
)

insert into #test(id,name) values(1,'vijay'),(2,'Amit'),(3,'JOHN')

Select * from #test where name ='vijay' COLLATE SQL_Latin1_General_CP1_CS_AS


Output:

Check Case-Sensitivity in SQL Server


Check Case-Sensitivity in SQL Server


No comments:

Post a Comment