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 many thanks for clicking into my question. I have a few
First of all, I know how to build a Java application. But I have
I've finally completed a working version of my first ever CSS-supported site (thanks to
First off, I am using Windows XP. I have multiple hard drives and it
First let me say that I really feel directionless on this question. I am
We are developing our first iPhone game, and all is going OK for now.
First, let's get the security considerations out of the way. I'm using simple authentication
First off, I understand the reasons why an interface or abstract class (in the
First off if you're unaware, samba or smb == Windows file sharing, \\computer\share etc.
First off, there's a bit of background to this issue available on my blog:

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.