2014-04-03 109 views
-1

當我運行查詢時,我得到不正確的語法錯誤。任何人都可以幫我解決它嗎?「。」附近的語法錯誤。在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

回答

1

它應該是:

CHARINDEX('.\',si.SoftwareImage) 

文檔到CHARINDEX用於SQL Server

文檔到CHARINDEX爲Sybase。