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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:23:59+00:00 2026-05-25T16:23:59+00:00

I am using openrowset to import a csv file into SQL Server. One of

  • 0

I am using openrowset to import a csv file into SQL Server. One of the columns in the csv file contains numbers in scientific notation (1.08E+05) and the column in the table it is being inserted

By default it is importing the value as 1 and ignoring the .08E+05.

I have tried using cast() and convert() to convert the value directly when the query is executed as well as setting up the datatype in the table as a character string and importing it as such. All of these methods have the same behavior where the .08E+05 is ignored.

Is there a way to have the value imported as 108000 instead of 1 without the .08E+05 without having to change the csv file itself?

Setting up the datatype as a varchar and reading in the csv file appears to have the same effect with the following code:

CREATE TABLE #dataTemp (StartDate datetime, Value varchar(12))

SET @insertDataQuery = 'SELECT Date, CSVValue from OpenRowset(''MSDASQL'', ''Driver={Microsoft Text Driver (*.txt; *.csv)}; DefaultDir=' 
SET @insertDataQuery = @insertDataQuery + 'C:\Data\;'',''SELECT * FROM '+ '11091800.csv' + ''')'

INSERT INTO #dataTemp EXEC(@insertDataQuery)

SELECT * FROM #dataTemp

Not all of the values in the CSV file have the scientific notation and the value without it, e.g. 81000 come across without issue.

  • 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-25T16:24:00+00:00Added an answer on May 25, 2026 at 4:24 pm

    For BULK INSERT methodologies I’ve often found it simpler to first move the data into a table of all varchars, then get rid of extraneous things like quoted delimiters and fix formatting. I remember having a heck of a time getting rid of the scientific notation, you can just play with the varchar table until you get it right. I remember attempting all kinds of precision/scale combinations until I finally found one that was compatible. I think for me it was FLOAT then DECIMAL(24,12)…

    SELECT CONVERT(DECIMAL(24, 12), CONVERT(FLOAT, '1.08E+05'));

    EDIT adding what I did to try to repro and/or demonstrate a less convoluted way.

    I created a very simple CSV file:

    StartDate,Value
    20110808,81000
    20110808,1.08E+05
    

    Then I ran the following code (for some reason I can’t get MSDASQL to run on my machine to save my life):

    CREATE TABLE #dataTemp(StartDate DATETIME, Value VARCHAR(32));
    
    BULK INSERT #dataTemp FROM 'C:\data\whatever.csv' 
        WITH (ROWTERMINATOR='\n', FIELDTERMINATOR=',', FIRSTROW = 2);
    
    SELECT * FROM #dataTemp
    GO
    SELECT StartDate, CONVERT(INT, CONVERT(FLOAT, Value)) FROM #dataTemp;
    GO
    DROP TABLE #dataTemp;
    

    Results:

    StartDate               Value
    ----------------------- --------
    2011-08-08 00:00:00.000 81000
    2011-08-08 00:00:00.000 1.08E+05
    
    StartDate               (No column name)
    ----------------------- ----------------
    2011-08-08 00:00:00.000 81000
    2011-08-08 00:00:00.000 108000
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi i am using SQL Server 2008. How can I import an Excel file
I'm trying to access a large Oracle database through SQL Server using OPENROWSET in
With SQL Server 2005 using SSMS, when I run this: SELECT * FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0','Excel
I am running into an issue, while I import an excel file into sql
I'm using OPENROWSET(BULK ...) to insert the contents of a file into my table.
I am using this: insert into bla select * FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0', 'Excel 8.0;HDR=YES;Database=c:\bla.xls', 'select
I'm doing a bulk insert from a fixed width text file using INSERT INTO
I wish to include a file path in an SQL Server query which is
I am using SQL Server 2008 64-bit Enterprise on Windows Server 2008 Enterprise 64-bit.
Using SQL Server 2005 Leave Table ID StartDate EndDate 001 02/03/2010 02/03/2010 002 02/03/2010

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.