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。 –