3

这是我的 mssql 函数代码。

 ALTER function [dbo].[UF_GetOrderProducts]
(
  @OrderId int
)
returns varchar(500)
as
begin

return
  (
  select CAST(VARCHAR(5),OP.ProductId)+'<br/>'
  from OrderProduct as OP

  where OP.OrderId = @OrderId
  for xml path(''), type
  ).value('.', 'varchar(500)')
end

它返回,VARCHAR' is not a recognized built-in function name.

4

1 回答 1

7
CAST(VARCHAR(5),OP.ProductId)

应该

CAST(OP.ProductId as VARCHAR(5)) 

请参阅MSDN 文档

于 2012-10-10T16:46:37.863 回答