“。\”附近的语法错误。在sql

问题描述:

当我运行查询时,我得到不正确的语法错误。任何人都可以帮我解决它吗?“。”附近的语法错误。在sql

SELECT 
    si.SoftwareImage as ImagePLName, 
    SUBSTRING(si.SoftwareImage, 0, CHARINDEX(\'.\',si.SoftwareImage)), 
    sib.SoftwareImageBuild as BuildID 
FROM 
    v000001.SoftwareProductBuilds spb 
JOIN 
    v000001.SoftwareProductBuildSoftwareImageBuilds spbisib ON spbisib.SoftwareProductBuildId = spb.SoftwareProductBuildId 
JOIN 
    v000001.SoftwareImageBuilds sib ON sib.SoftwareImageBuildId = spbisib.SoftwareImageBuildId 
JOIN 
    v000001.SoftwareImages si ON si.SoftwareImageId = sib.SoftwareImageId 
WHERE 
    spb.SoftwareProductBuild = '123456' 
+0

您正在使用哪些DBMS? –

+0

此问题是由简单的印刷错误造成的。虽然类似的问题可能在这里讨论,但这个问题的解决方式不太可能有助于未来的读者。 – Kermit

+0

@a_horse_with_no_name我猜想[SQL Server](http://technet.microsoft.com/en-us/library/ms186323.aspx) – Kermit

它应该是:

CHARINDEX('.\',si.SoftwareImage) 

文档到CHARINDEX用于SQL Server

文档到CHARINDEX为Sybase。