Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8418757
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T02:24:55+00:00 2026-06-10T02:24:55+00:00

How to efficiently combine a direct SQL query and Linq To SQL query? Linq

  • 0

How to efficiently combine a direct SQL query and Linq To SQL query? Linq To SQL doesn’t support XQuery. So I have to combine the results of a SQL with XQuery and column based Linq To SQL?

Any pointers is appreciated. Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T02:24:57+00:00Added an answer on June 10, 2026 at 2:24 am

    Chris Cavanagh has a couple blog posts that provide options for leveraging XQuery in conjunction with LINQ to SQL.

    1. SQL Server XQuery with LINQ to SQL provides the framework for a solution that would involve embedding the XQuery into user-defined functions, which can be accessed from LINQ to SQL

    2. Modifying LINQ to SQL command text and Modifying LINQ to SQL command text again provide a way to extend LINQ to SQL’s query execution, by manipulating the generated command text to support XQuery constructs.

    The end result is you can actually use XQuery directly from your DataContext, by writing code that looks like:

    var results = from r in MyXmlFieldTable
       let date = context.XQueryDateTime( r.XmlValues, "MyContainer/MyDateTime" )
       where date < DateTime.Now.AddDays( -5 )
       select new
       {
           Date = date,
           FirstName = context.XQueryString( r.XmlValues, "MyContainer/FirstName" ),
           LastName = context.XQueryString( r.XmlValues, "MyContainer/LastName" )
       };
    

    (However, if you find that you need to do this kind of thing a lot, there’s a chance you will be better off with a document database like MongoDB or RavenDB, which are meant for working with hierarchical/post-relational models)

    As a side note about XQuery and SQL in general, you will get varying degrees of support in different versions. Specifically, the XQuery support in SQL 2005 is a limited subset of the support in later versions.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I could use some pointers on my query I have three external tables that
Any efficient/reliable way to expose one event? I have a class, MultipleDocumentCopier that copies
I have multiple files of text that I need to read and combine into
I have 3 byte arrays in C# that I need to combine into one.
How would I combine these two queries into 1 and to run efficiently on
I have a very large column-delimited file coming out of a database report in
Is there a built-in php function, or a simple (efficient!) way to combine built-in
I am having trouble efficiently selecting the information I need to display. Hopefully someone
I am trying to efficiently read from the stdin by using setvbuf in `_IOFBF~
How can I efficiently and easily sort a list of tuples without being sensitive

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.