从SQL Server数据库中查询μ字符

时间:2015-07-27 11:00:32

标签: sql sql-server sql-server-2012

RawMaterialID   Level01 Level02 Level03          Level04    Level05        Level06  Description60Digit                                        Description30Digit
    393             POLYBAGS PB.HGR 33x46cm 30.5μm  HANGER HOLE HANGER.HOLE1.5" LDPE    PB.HGR 33x46cm 30.5μm HANGER HOLE HANGER.HOLE1.5" LDPE  PB.HGR 33x46cm 30.5μm

我正在尝试使用以下SQL查询检索上面的行:

SELECT * 
FROM [dbo].[RawMaterial] 
WHERE [Level01] = 'POLYBAGS' 
  AND [Level02] = 'PB.HGR' 
  AND [Level03] = '33x46cm 30.5μm' 
  AND [Level04] = 'HANGER HOLE' 
  AND [Level05] = 'HANGER.HOLE1.5"' 
  AND [Level06] = 'LDPE' 

由于Level03列中的'μ'字符,查询失败,是否有解决方法?

表设计:

[RawMaterialID] [int] IDENTITY(1,1) NOT NULL,
[RMProcurementGroupID] [int] NULL,
[Level01] [nvarchar](255) NULL,
[Level02] [nvarchar](255) NULL,
[Level03] [nvarchar](255) NULL,
[Level04] [nvarchar](255) NULL,
[Level05] [nvarchar](255) NULL,
[Level06] [nvarchar](255) NULL,
[Description60Digit] [nvarchar](255) NULL,
[Description30Digit] [nvarchar](255) NULL,
[RawMaterialTypeID] [int] NULL 

1 个答案:

答案 0 :(得分:3)

使用以下方式进行测试:

AND [Level03]=N'33x46cm 30.5μm'

告诉系统要比较的字符串是NVARCHAR