繁体   English   中英

SQL 查找以“~0000”结尾的部件号

[英]SQL looking for a part number ending in '~0000'

我正在尝试查找以 ~0000 结尾的记录,例如 ABC~0000,但我尝试的所有内容似乎都不起作用。 一些例子:

    and left (mfr_part_number, 4) = 'ABC~'  -- finds nothing
    and left (mfr_part_number, 3) = 'ABC'   -- finds stuff
    AND RIGHT(MFR_PART_NUMBER, 4) = '0000'  -- finds nothing
    AND RIGHT(MFR_PART_NUMBER, 5) = '~0000' -- finds nothing
    and DbFunctions.Like(MFR_PART_NUMBER,'%0000') -- suggested elsewhere, but not recognized in MSSMS.

我在用:

    SQL Server Management Studio                    15.0.18206.0
    Microsoft Analysis Services Client Tools        15.0.1567.0
    Microsoft Data Access Components (MDAC)         10.0.18362.1
    Microsoft MSXML                                 3.0 6.0 
    Microsoft .NET Framework                        4.0.30319.42000
    Operating System                                10.0.18363

谢谢!

您是否在 WHERE 子句中使用了所有这些 AND 语句? 如果是这样,如果没有符合所有条件的数据,则不会返回任何内容。

尝试

SELECT column1, column2...
FROM yourdb
WHERE MFR_PART_NUMBER LIKE '%0000'

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM