locked
Linq to XML RRS feed

  • Question

  • Hello,

    I need to write a method that uses Linq to Sql to parse an xml fragment, populate columns in a table, and then creates another xml fragment.  I know there are SQL Server 2008 R2 ways to do this w/o using Linq.  However, I know Linq fairly well.  Is this the way to proceed?

     

    Friday, January 28, 2011 12:08 PM

Answers

  • Mattaniah,

    You can use Linq do XML only if you are coding CLR objects to be used in SQL (stored procedures, functions, triggers, etc.).. these objects are coded in C#, for example, compiled and then you "register" this object to be used in SQL.

    But, if you want to write common queries, by using Transact-SQL, than you cannot use Linq. SQL Server has lots of features that offer you the ability to work with XML with Transact-SQL, you don´t need to write code in CLR.

    Cheers,

    Raul Santos Neto


    http://raulsantosneto.wordpress.com
    • Marked as answer by Mattaniah Friday, January 28, 2011 4:26 PM
    Friday, January 28, 2011 2:42 PM