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
I am trying to cast an ntext column (ProductXML)to xml and then run selects on the case.
but i am getting the following error: Msg 4121, Level 16, State 1, Procedure viewProductExportUpdated2, Line 4 Cannot find either column "ProdXml" or the user-defined function or aggregate "ProdXml.value", or the name is ambiguous.
The site is an old site and we dont have time to change the coloumn to xml etc..
thanks
mike