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
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/tech/database/279944.html