Note that there are some explanatory texts on larger screens.

plurals
  1. POfloat changing to scientific notation on insert
    text
    copied!<p>I have contactid field that is a float with 11 or 12 numbers when I do a insert the numeric number that is the float changes to a scientific notation resulting in a duplicate key error. If I just run the Select query I get the result I expect. But when I do the insert I get the following error. I've tried just about every cast convert there is and still end up with a scientific notation?</p> <p><code>Msg 2627, Level 14, State 1, Line 1 Violation of PRIMARY KEY constraint 'metavalues_primarykey'. Cannot insert duplicate key in object 'dbo.metavalues'. The duplicate key value is (4.56219e+014, 41070, 0). The statement has been terminated.</code></p> <p>Any idea why? </p> <p>I know having the DB design setup this way isn't the way it should be but it is what I have to work with. So please don't tell me that I need to change my design because I cannot do that not mine to make changes to design.</p> <pre><code> contactid fieldgroup metatableid Subfields parent Metavalue 456209564532953 1004 41140 0 0 NULL 456209592021740 1004 41130 0 0 NULL 456210014777935 1004 41097 0 0 NULL 456211077079073 1004 41107 0 0 NULL INSERT INTO contactease.dbo.metavalues (contactid, fieldgroup, metatableid, subfield, metaflags, metavalue) SELECT DISTINCT m.contactid, 1004, mt.metatableid, 0, 0, NULL FROM interact.dbo..[INT_LST_CUSTOM_ENUM] sic INNER JOIN interact.dbo.INT_AUX_LST_CUSTOM c ON c.LST_CUSTOM_ENUM_ID = sic.LST_CUSTOM_ENUM_ID AND c.DIRECTORY_ID &lt;&gt; -4 INNER JOIN contactease.dbo.main m ON m.custnum1 = c.LISTING_ID INNER JOIN contactease.dbo.metatable mt ON mt.metaname = sic.LST_CUSTOM_ENUM_NM </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload