0
我想使用powershell作爲較大任務的一部分運行以下訪問查詢。使用powershell運行使用detediff和逗號的訪問查詢
SELECT PG.LastName+`", `"+PG.FirstName AS Name, PG.Gender, PG.Ethnicity, PG.Language, PG.PhoneNumber, PG.FinancialClass AS FinClass, PG.BirthDate, Int(DateDiff(`"d`",PG.BirthDate,Now())/365.2425) AS Age, Switch(Int(DateDiff(`"d`",PG.BirthDate,Now())/365.2425)<12,PG.GLastName,Int(DateDiff(`"d`",PG.BirthDate,Now())/365.2425)>=12,Null) AS GLastName, Switch(Int(DateDiff(`"d`",PG.BirthDate,Now())/365.2425)<12,PG.GFirstName,Int(DateDiff(`"d`",PG.BirthDate,Now())/365.2425)>=12,Null) AS GFirstName FROM TestData INNER JOIN PG ON TestData.PI = PG.PINumber WHERE (((PG.Id) Not In (734,735)))
當我經常從訪問運行查詢時,它工作正常。因爲我試圖通過PowerShell來運行它,我添加了`登錄引號和逗號的前面,但查詢還是拋出下面的錯誤,當我運行它
IErrorInfo.GetDescription失敗,E_FAIL(0x80004005的)
我檢查了一些以前的線程,並進行了上述更改,但它似乎仍然沒有工作。
任何有關上述查詢可能出錯的建議?
感謝, Sreekar