-
Notifications
You must be signed in to change notification settings - Fork 5
sql语句查询时强制区分大小写
web240 edited this page Jul 7, 2016
·
1 revision
MS SQL 查询时默认是不区分大小写,可以用语句强制sql语句查询时区分大小写
区分大小写
select * from a where a.Status=’w’ collate Chinese_PRC_CS_AI
不区分大小写
select * from a where a.Status=’W’ collate Chinese_PRC_CI_AI
如果觉得这样麻烦,可以修改表来达到目的:
区分大小写
ALTER [TABLE] tb
ALTE COLUMN [colname] nvarchar(100) COLLATE Chinese_PRC_CS_AS
不区分大小写
ALTER [TABLE] tb
ALTER COLUMN [colname] nvarchar(100) COLLATE Chinese_PRC_CI_AS