0
我已經在Web上看得相當廣泛,但一直未能找到我有一個查詢,我試圖寫入哪些值傳遞給一個HTML表格的電子郵件輸出。對於其中一列,我想傳遞一個鏈接。有沒有辦法做到這一點?我目前收到錯誤說 "Conversion failed when converting the varchar value '<a href="http://testServer/webnow/index.jsp?action=filter&username=anonymous&drawer=AP-General&folder=' to data type int."
有沒有辦法使用TSQL查詢來傳遞HTML鏈接?
請參閱下面的代碼片段。
SET @Body = COALESCE(@Body + '', '') +
CAST((SELECT DISTINCT Api.GLAccountID,
api.CostCenterNumber,
api.VendorNumber,
--SPECIFICALLY THIS LINE...
'<a href="http://testServer/webnow/index.jsp?action=filter&username=anonymous&drawer=AP-General&folder=' + v.VendorID + '&tab=' + api.Invoice + '">' + api.Invoice + '</a>'
FROM dummytable api
FOR XML RAW('TR'), ELEMENTS) AS NVARCHAR(MAX)) + '</TABLE>'
常見的錯誤。使用它們構建字符串時,將INTs轉換爲varchar。 –