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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T01:12:32+00:00 2026-05-23T01:12:32+00:00

First, thanks for all your help! You really make a difference, and I GREATLY

  • 0

First, thanks for all your help! You really make a difference, and I GREATLY appreciate it.

So I have a Varchar column and it holds a 16 digit number, example: 1000550152872026

select *
FROM Orders 
where isnumeric([ord_no]) = 0

returns: 0 rows


select cast([ord_no] as bigint)
FROM Progression_PreCall_Orders o
order by [ord_no]

returns: Error converting data type varchar to bigint.

How do I get this 16 digit number into a math datatype so I can add and subtract another column from it?

UPDATE: Found scientific notation stored as varchar ex: 1.00054E+15

How do I convert that back into a number then?

  • 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-23T01:12:33+00:00Added an answer on May 23, 2026 at 1:12 am

    DECIMAL datatype seems to work fine:

    DECLARE @myVarchar AS VARCHAR(32)
    SET @myVarchar = '1000550152872026'
    
    DECLARE @myDecimal AS DECIMAL(38,0)
    SET @myDecimal = CAST(@myVarchar AS DECIMAL(38,0))
    SELECT @myDecimal + 1
    

    Also, here’s a quick example where IsNumeric returns 1 but converting to DECIMAL fails:

    DECLARE @myVarchar AS VARCHAR(32)
    SET @myVarchar = '1000550152872026E10'
    SELECT ISNUMERIC(@myVarchar)
    
    DECLARE @myDecimal AS DECIMAL(38,0)
    SET @myDecimal = CAST(@myVarchar AS DECIMAL(38,0)) --This statement will fail
    

    EDIT
    You could try to CONVERT to float if you’re dealing with values written in scientific notation:

    DECLARE @Orders AS TABLE(OrderNum NVARCHAR(64), [Date] DATETIME)
    INSERT INTO @Orders VALUES('100055015287202', GETDATE())
    INSERT INTO @Orders VALUES('100055015287203', GETDATE())
    INSERT INTO @Orders VALUES('1.00055015287E+15', GETDATE()) --sci notation
    
    SELECT 
        CONVERT(FLOAT, OrderNum, 2) + 
        CAST(REPLACE(CONVERT(VARCHAR(10), GETDATE(), 120), '-', '') AS FLOAT)
    FROM @Orders
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

first of all thanks for taking your time! I'm a junior Dev, working with
First, thanks for all the help I've received so far from StackOverflow. I've learned
First of all many thanks for clicking into my question. I have a few
First of all thanks in advance, this has been very frustrating and I'm hoping
First, I would to thank everyone for all the help they provide via this
First hi and thanks in advance in ASP.NET : assume that i have a
Thanks for your replies. First I am explaining my requirement :- I created my
Hello all Windows Mobile Experts! I have really drowned in the world of developing
First, thanks for the StackOverflow team, cause it's a very useful website, since i'm
This is my first question. Thanks to everyone who contributes to this site, it's

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.