Ex:- For example we are uploading a sheet with mobile call details. which is having one field called “dialed number “. It might be more than 10 digits some times and the same has been converting to Scientific notations in the excel sheets and the same we are uploading to the database. How to convert this scientific notation to numbers in the database.
Kindly help me by providing the possible ways to convert the Scientific notation to Number. Please let me know if any some more information needed.
Excel does not change the actual value of a cell, it just displays it in the scientific notation.
Have you actually tried to import data from excel into SQL Server?
Related
What do you avoid when creating and filling out a Excel spreadsheet of data for a SQL database (certain formats, characters, character length issues?)
2.Does it matter how dates are formatted?
VARCHAR or INTEGER errors you've seen?
Finally, what SQL or Python queries did you use to address errors you found that you might have shared for questions 1-3?
The easiest way would be, if you can import Database-EDI (e.g. Oracle SQL Developer) a TXT- or CSV-Excel-Export into our Database.
→ Depending on the database, different requirements must be observed.
The main focus is on the correct formatting with regard to the country settings (Excel & database):
Excel-Format-Date YYYY-M-DD HH24:MM / Databe-Timestamp YYYY-MM-DD HH24:MM:SS.FFFF
→ That would not work
In addition, make sure that Excel does not cut any numbers:
Excel-Format-Long-Number 89632150000 (orignal 896321512345 )
→ Excel automatically shortens the number in the standard settings.
The length of a text must not exceed the specified maximum length in the assigned column of the type (VARCHAR).
I think these would be the main points to look out for.
Have an issue where when a report is downloaded, a field that has over 15 digits is converted to scientific notation instead of displaying the full digits (i.e. 672000000000000 = 6.72×10 to the 14th degree). I know this is an excel feature, but is there any workaround for it on the SSRS end?
Thanks!
This is an Excel issue, not a Reporting Services one. The SSRS CSV export should contain the number as it exists in the report, e.g. 672000000000000
The default behaviour for Excel (which you are presumably using to open the CSV file) is to display values this large using scientific notation, i.e. "6.72E+14". This behaviour can't be controlled from within SSRS.
As an alternative you might consider using the Excel render method for the report, which might give you more control over the display of these numbers.
Excel won't mess with it if you convert the expression to a string within SSRS.
Go into the expression for the text box and type the following:
=Str(Fields!YourFieldHere.Value)
Is there a way for a number to stay as a number and not a string even with the percent sign?
The reason I write a function in a query like:
Format(IIf([BDE MTOE CURRENT]=0,0,[PROJECTED OH]/[BDE MTOE CURRENT]),"Percent")
is so that I can output a complete report without having to do anything to it.
Microsoft Access (My version is 2007) changes it to a string.
You do not need to format the number in the SQL query. There is a formatting option for the values in Access reports:
If you are exporting the data to Excel there is a similar option for the Excel cells.
The bottomline is: numbers should stay numbers. That way they are better manageable: you can sort them, you can apply mathematical operations on them
Agreed. I have decided to keep numbers as decimals and will format the spreadsheet columns into percentage from MS Access using VBA. I kinda hoped I could do it all from SQL.
I am trying to calculate Total Sales at a store. I have product Price in a column called UNIT_PRICE. All the prices have 2 decimal places example: 34.54 or 19.99 etc and they are imported as type:float in the schema. (UNIT_PRICE:float)
When I perform the select Query: "SELECT CompanyName, SUM(Unit_Price) as sumValue" etc I get the following returned in the column, but only "sometimes".
2.697829165015719E7
It should be something like: 26978291.65
As I am piping this out into spreadsheets and then charting it I need it to be in the type float or at least represent a normal price format.
I have tried the following but still having issues:
Source: Tried converting original data type to BigDecimal with only 2 decimal points in the source data and then exporting to the csv for import into bigquery but same result.
Bigquery: Tried converting to a string first and then to a float and then SUM but same result. "SELECT CompanyName, SUM(Float(String(Unit_Price))) as sumValue"
Any ideas on how to deal with this?
Thanks
BigQuery uses default formatting for floating point numbers, which means that depending on the size of the number, may use scientific notation. (See the %g format specifier here)
We tried switching this, but it turns out, it is hard to get a format that makes everyone happy. %f formatting always produces decimal format, but also pads decimals to a 6 digit precision, and drops decimals beyond a certain precision.
I've filed a bug to allow an arbitrary format string conversion function in BigQuery. It would let you run SELECT FORMAT_STRING("%08d", SUM(Unit_Price)) FROM ... in order to be able to control the exact format of the output.
Do you see this in the BQ browser tool or only on your spreadsheet?
BQ float is of size of 8 bytes, so it can hold numbers >9,000,000,000,000...
I find it that sometimes when Excel opens a flat file (csv) it converts it to the format you mentioned. To verify this is the case, try to open your csv with notepad (or other flat file editor), before you try with excel.
If this is indeed the issue, you can configure the excel connector to treat this field as string instead of number. other option would be to convert it to string and concat "" to the number. this way the spreadsheet will automatically treat it as string. afterwards you can convert it back to number in the spreadsheet.
Thanks
I'm using a mail job and proc to send mails to the users. It turned out that I didn't make the control for the scientific notations and they complained about it. Now, I changed the code but I can't test it. It's not all the numbers which are transformed into scientific form, so I'm looking for a way to make me know that my code is working ok.
What I need to know is, when is scientific notation used? Which numbers are transformed to scientific notation?
When you need to convert real values or float values to varchar or nvarchar sql would convert scientific notation when the digits are more than seven
When you convert real/float values to varchar/nvarchar, it will
convert as the regualr decimal number when the digits are less than 7
otherwise it will use the scientific notation.