日期:2014-05-17 浏览次数:20571 次
--> 测试数据:[tb] IF OBJECT_ID('[tb]') IS NOT NULL DROP TABLE [tb] GO CREATE TABLE [tb]([name] VARCHAR(14)) INSERT [tb] SELECT '23233-34' UNION ALL SELECT '1121-34A' UNION ALL SELECT '4343-3455-34B' UNION ALL SELECT 'G332-34C' UNION ALL SELECT 'HGF-231-45A' UNION ALL SELECT 'HGD-P1-P2-54B' UNION ALL SELECT 'kkj-weweew-34A' UNION ALL SELECT 'KLI-O2-P4-54D' UNION ALL SELECT 'HUI-we-rre-34B' --------------开始查询-------------------------- SELECT * FROM [tb] WHERE name LIKE '%34' OR name LIKE '%34[a-z]' ----------------结果---------------------------- /* name -------------- 23233-34 1121-34A 4343-3455-34B G332-34C kkj-weweew-34A HUI-we-rre-34B (6 行受影响) */