SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER VIEW [dbo].[viewProductExportUpdated2]
AS
SELECT dbo.ProductCategories.ProductCategoryID AS ProductCode, dbo.ProductCategories.ProductCategoryName AS ProductTitle,
dbo.Products.ShortDescription AS ProductShortDesc, dbo.Products.LongDescription AS ProductLongDesc,
CAST(dbo.Products.ProductXML AS XML) AS ProdXml, ProdXml.value('data(Products/PackSize)[1]', 'nvarchar(max)') AS ProductPackSize
FROM dbo.ProductCategories INNER JOIN
dbo.Products ON dbo.ProductCategories.ProductCategoryID = dbo.Products.ProductCategoryID
WHERE (dbo.ProductCategories.Deleted = 0)
GO
SET ANSI_NULLS OFF
GO
SET QUOTED_IDENTIFIER OFF
GO
我試圖將ntext列(ProductXML)轉換爲xml,然後運行案例選擇。Sql強制轉換爲xml,然後運行.value強制轉換
,但我得到以下錯誤: 消息4121,級別16,狀態1,過程viewProductExportUpdated2,4號線 找不到任何列「ProdXml」或用戶定義的函數或聚合「ProdXml.value」,或這個名字是不明確的。
該網站是一個古老的網站,我們沒有時間來改變coloumn爲xml等。
感謝
邁克