数据库默认查询是不区分大小写
作者:互联网
1. 例子:
SELECT * FROM [NORTHWND].[dbo].[Customers] where CompanyName = 'alfreds futterkiste'
2. 运行结果如下:
3.如何让查询区分大小写?(利用collate)
把上面的语句改为如下:
SELECT * FROM [NORTHWND].[dbo].[Customers] where CompanyName collate Latin1_General_CS_AS = 'alfreds futterkiste'
4.我想把这一列改成区分大小写(case sensitive)
但会出错,错在哪里呢?要怎么修改呢?
alter table [NORTHWND].[dbo].[Customers] alter column CompanyName nvarchar(40) collate SQL_Latin1_General_CP1_CS_AS
5. 在EF中如何利用collate(好像只有在EF Core 5.0中引入)
https://docs.microsoft.com/en-us/ef/core/miscellaneous/collations-and-case-sensitivity#explicit-collation-in-a-query
标签:Customers,dbo,CompanyName,数据库,默认,大小写,collate,NORTHWND 来源: https://www.cnblogs.com/keeplearningandsharing/p/16576844.html