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

  • SEARCH
  • Home
  • 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 8113695
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T02:54:43+00:00 2026-06-06T02:54:43+00:00

I was wondering whether anyone knows definitively if LINQ to SQL has the capability

  • 0

I was wondering whether anyone knows definitively if LINQ to SQL has the capability of generating TSQL code that contains the ISNULL function?

I’m aware that using the coalesce operator (??) in a query:

from o in Table
where (o.Field ?? 0) > 0
select o

will cause LINQ to SQL to emit the COALESCE function:

SELECT [t0].[Field]
FROM [Table] AS [t0]
WHERE (COALESCE([t0].[Field],0)) > 0

And, that using the conditional operator (?:) in a query:

from o in Table
where (o.Field == null ? 0 : o.Field) > 0
select o

will result in TSQL containing a CASE statement:

SELECT [t0].[Field]
FROM [Table] AS [t0]
WHERE (
    (CASE
        WHEN [t0].[Field] IS NULL THEN 0
        ELSE [t0].[Amount]
     END)) > 0

But, can LINQ to SQL be coerced into generating TSQL code that contains ISNULL like the following?

SELECT [t0].[Field]
FROM [Table] AS [t0]
WHERE (ISNULL([t0].[Field],0)) > 0

I’m betting the answer is “no, it can’t,” but I’d like to see something authoritative.

  • 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-06T02:54:44+00:00Added an answer on June 6, 2026 at 2:54 am

    The only way I know of accomplishing this is via your own class like so:

    public partial class LocalTestDataContext
    {
        [Function(Name = "IsNull", IsComposable = true)]
        [return: Parameter(DbType = "NVarChar(MAX)")]
        public string IsNull(
            [Parameter(Name = "field", DbType = "NVarChar(MAX)")] string field,
            [Parameter(Name = "output", DbType = "NVarChar(MAX)")] string output)
        {
            return ((string)(this.ExecuteMethodCall(this,
                    ((MethodInfo)(MethodInfo.GetCurrentMethod())),
                    field, output).ReturnValue));
        }
    }
    

    This is under “Take #3” from here.

    var ctx = new LocalTest.LocalTestDataContext(); 
    
    var query = from c in ctx.Categories 
    orderby ctx.IsNull(c.Description1, "") + ctx.IsNull(c.Description2, "") 
    select c; 
    query.Dump();
    

    And will generate T-SQL with ISNULL().

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

Sidebar

Related Questions

I was wondering whether anyone knows of any tools available that perform the task
Just wondering whether anyone knows how to get blogger labels into alt tags in
I'm wondering whether anyone has been able to use the Microsoft Chart control in
I was wondering if anyone could confirm for certain whether SQL Azure supports hierarchy
I am just wondering whether anyone knows where I can get a compiled version
I am having issues with my php script. I was wondering whether anyone knows
I was just wondering whether anyone knows why the property FileInfo.Length is of type
Just wondering if anyone knows whether its possible to gzip results before putting the
I'm just wondering, does anyone know, whether uniqid function in PHP has a certain
Just wondering whether anyone knows what events an HTML5 <input type=number /> element fires

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.