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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:25:08+00:00 2026-05-28T01:25:08+00:00

Is it possible to use SUM function in a SQL query on a field

  • 0

Is it possible to use SUM function in a SQL query on a field that has been set as nvarchar but only contains numbers?

  • 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-28T01:25:09+00:00Added an answer on May 28, 2026 at 1:25 am

    This is possible by casting:

    SELECT SUM(CAST(NVarcharCol as int))
    

    However, this will throw an exception is 1 or more records cannot be CAST to an int.

    If your column is only ever going to have numerical values, I would recommend changing the data type to int to save future problems.

    If you are not able to change the data type, then the following WHERE clause would prevent exceptions from being thrown:

    WHERE ISNUMERIC([NVarcharCol])=1
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to use boost::fusion::invoke function to call a function that has default
Is it possible to use gcov for coverage testing of multi-threaded applications? I've set
I can use SUM(xpath) to sum all node values, but I also have a
Is it possible to use a set, like (1, 2, 3, 4, 5) for
I have figured out that I can use hibernate to get the sum of
Can functors be defined locally within the body of a function? One possible use
I use both C++ and C# and something that's been on my mind is
I'm working on a function in Excel that will allow me to sum columns
Any function that consists of a return statement only could be declared constexpr and
In MySQL, it is possible to use an alias in GROUP BY clause that

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.