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 7063223
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:41:18+00:00 2026-05-28T04:41:18+00:00

My problem seems to be very simple but I’m stuck here. I have a

  • 0

My problem seems to be very simple but I’m stuck here. I have a table which has an “nvarchar” column called “SrcID” and I store both numbers and strings in that. Now, when I try to check for “IsNumeric” on that column in a “Join” condition, something like below,

   ISNUMERIC(SrcID) = 1 AND SrcID > 15

I am getting the following error:

  Msg 245, Level 16, State 1, Line 47
  Conversion failed when converting the nvarchar value 'Test' to data type int.

Amazingly, when I remove the check “SrcID > 15”, my query is running properly. Should I include anything else in this statement?

Please help me in fixing the issue. Thanks in advance!!

  • 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-05-28T04:41:19+00:00Added an answer on May 28, 2026 at 4:41 am

    You can’t count on the order in which a database will evaluate filtering expressions. There is a query optimizer that will evaluate your SQL and build a plan to execute the query based on what it perceives will yield the best performance.

    In this context, IsNumeric() cannot be used with an index, and it means running a function against every row in the table. Therefore, it will almost never provide the best perceived performance. Compare this with the SrcID > 15 expression, which can be matched with an index (if one exists), and is just a single operator expression even if one doesn’t. It can also be used to filter down the number of potential rows where the IsNumeric() function needs to run.

    You can likely get around this with a view, a subquery, a CTE, a CASE statement, or a computed column. Here’s a CTE example:

    With NumericOnly As 
    (
        SELECT <columns> FROM MyTable WHERE IsNumeric(SrcID) = 1
    )
    SELECT <columns> FROM NumericOnly WHERE SrcID > 15
    

    And here’s a CASE statement option:

    SELECT <columns> FROM MyTable WHERE CASE WHEN IsNumeric(SrcIC) = 1 THEN Cast(SrcID As Int) ELSE 0 END > 15
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a strange problem which probably has a very simple solution, I just
I have a very simple problem, but I can't seem to solve it. I
This seems like a very simple problem, but I cannot get a scrollbox to
I've a problem with something that seems to be very simple. My app has
This problem seems very simple, however I cannot get this to work. I have
On the face of it, this seems a very simple problem but for some
I have a very simple page built in asp.net (.NET Framework 4) which has
This seems like a very simple and a very common problem. The simplest example
I have a very simple C# DataTable problem that I cannot seem to wrap
The problem seems very strange. I have a AJAX helper function within a same

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.