# Consistently format a real as a string for parsing to SQL?

**URL:** <https://community.wolfram.com/t/consistently-format-a-real-as-a-string-for-parsing-to-sql/8751>\
**Category:** Questions\
**Tags:** data-science\
**Created:** [June 15, 2016, 2:02pm UTC](https://community.wolfram.com/t/consistently-format-a-real-as-a-string-for-parsing-to-sql/8751 "2016-06-15T14:02:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![brad](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/brad/32/498_2.png) [@brad](https://community.wolfram.com/u/brad)\
**Post date:** [June 15, 2016, 2:02pm UTC](https://community.wolfram.com/t/consistently-format-a-real-as-a-string-for-parsing-to-sql/8751/1 "2016-06-15T14:02:42Z")

</div>

I’ve written a routine for generating command strings to insert mostly numeric records into a SQL database. It chokes if I try to format a Real above a certain value, because it switches to scientific notation. This isn’t actually a fragment of the code, but it illustrates the point:

```
In[1120]:= x = {7.5, 7500., 75000., 750000., 7500000.};
ToString[#] & /@ x

Out[1121]= {"7.5", "7500.", "75000.", "750000.", " 6
 7.5 10"}

```

I could slip an AccountingForm[] call in there, but sometimes the numbers are negative, so they get wrapped in brackets. There are plenty of long-winded solutions. Any elegant ones?

- Brad

---

<div class="post-metadata">

**Author:** ![fkampas](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/fkampas/32/41217_2.png) [@fkampas](https://community.wolfram.com/u/fkampas)\
**Post date:** [June 15, 2016, 3:24pm UTC](https://community.wolfram.com/t/consistently-format-a-real-as-a-string-for-parsing-to-sql/8751/2 "2016-06-15T15:24:15Z")

</div>

In[26]:= ToString[NumberForm[#, 0, ExponentStep → [Infinity]]] & /@ x

```
Out[26]= {"7.5", "7500.", "75000.", "750000.", "7500000."}

```
