Entity Framework for a stored procedure that returns results of an XPath query on XML data.

Posted on 2009-05-01
Last Modified: 2012-05-06
I have a stored procedure that returns XML column elements and attributes for a user-specified row in a SQL Table as a row.

Since this sql stored procedure returns a single row containing data from a XML column - (and the columns of this row are not defined by an existing SQL Table or view) - what return type should be specified for the EDMX Function Import?

ALTER PROCEDURE [dbo].[GetXmlData]

	@GuidOfInterest uniqueidentifier

declare @XmlCol as xml;							

select @XmlCol = XmlTableCol from dbo.TableWithXmlCol

	    where UniqueGuid = @GuidOfInterest


select @XmlCol.value('(//Root/@RootName)[1]', 'char(38)' ) as RootName,

          @XmlCol.value('(//Root/@RootGUID)[1]', 'char(38)' ) as RootGuid,

          @XmlCol.value('(//Root/SetupName)[1]', 'char(80)') as SetupName

Open in new window

Question by:MDKIMZEY
    1 Comment

    Accepted Solution

    There probably is a way to call a stored procedure that returns the result of an XPath query on XML data in a SQL table using Entity Framework - but I have not found it.
    For this case, as well as stored procedures that use the PIVOT command, I had to use straight calls were successful.

    Featured Post

    Gigs: Get Your Project Delivered by an Expert

    Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

    Join & Write a Comment

    Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
    The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (…
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now