Our SQL Server's collation is set to SQL_Latin1_General_CP1_CI_AS
I have a requirement where we have the same values with different cases but SQL Server treats them the same since our collation is set to case insensitive at the server level. My requirement is that I need to treat each value as different based on the case sensitivity for one particular query. I'm using COLLATE SQL_Latin1_General_CP1_CS_AS
in the WHERE
clause to enforce case sensitivity. My question is: will this collation be applied only to this query or will it end up changing this setting at the column or table level for all queries that use this column?
Create Table #tmpTest
(
id int primary key identity(1,1),
name varchar(100)
)
Insert Into #tmpTest values ('TestQuery'),('TESTQUERY'),('TEstquerY')
Select * from #tmpTest
Where name = 'TestQuery'
Select * from #tmpTest
Where name = 'TestQuery'
Collate SQL_Latin1_General_CP1_CS_AS