资源描述:
《如何让对字符串大小写敏感》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、如何让sqlserver对查询字符串大小写敏感select*fromtableNamewherenamelike'%c%'要选出只包括小写c的name如何实现?---------------------------------------------------------------CREATETABLE[Table7]([string][varchar](50)COLLATEChinese_PRC_CI_AINULL,[curdate][datetime]NOTNULLCONSTRAINT[DF_
2、Table7_curdate]DEFAULT(getdate()))ON[PRIMARY]GOinserttable7(string,curdate)values('a12','2002-08-2717:21:05.140')inserttable7(string,curdate)values('A21','2002-08-2717:21:07.433')inserttable7(string,curdate)values('aaa','2002-08-2717:21:18.097')insertta
3、ble7(string,curdate)values('Asss','2002-08-2717:21:23.917')inserttable7(string,curdate)values('sAs','2002-08-2717:21:26.140')inserttable7(string,curdate)values('aaaaaq','2002-08-2717:21:28.240')inserttable7(string,curdate)values('xxxa','2002-08-2717:21:
4、32.307')inserttable7(string,curdate)values('121A','2002-09-0514:34:11.910')goSELECT*FROMTable7stringcurdate--------------------------------------------------------------------------------------------------------a122002-08-2717:21:05.140A212002-08-2717:2
5、1:07.433aaa2002-08-2717:21:18.097Asss2002-08-2717:21:23.917sAs2002-08-2717:21:26.140aaaaaq2002-08-2717:21:28.240xxxa2002-08-2717:21:32.307121A2002-09-0514:34:11.910(8row(s)affected)--字符集是Chinese_PRC_CI_AI,大小写不敏感SELECT*FROMTable7WHERE(stringLIKE'%a%')str
6、ingcurdate--------------------------------------------------------------------------------------------------------a122002-08-2717:21:05.140A212002-08-2717:21:07.433aaa2002-08-2717:21:18.097Asss2002-08-2717:21:23.917sAs2002-08-2717:21:26.140aaaaaq2002-08
7、-2717:21:28.240xxxa2002-08-2717:21:32.307121A2002-09-0514:34:11.910(8row(s)affected)--改变字符集altertabletable7ALTERCOLUMNstringvarchar(50)COLLATEChinese_PRC_CS_AIgo--字符集是Chinese_PRC_CS_AI,大小写敏感SELECT*FROMTable7WHERE(stringLIKE'%a%')stringcurdate-----------
8、---------------------------------------------------------------------------------------------a122002-08-2717:21:05.140aaa2002-08-2717:21:18.097aaaaaq2002-08-2717:21:28.240xxxa2002-08-2717:21:32.307(4row(s)affected)--改变字符集altertab