All Forums Database
Diecorp 14 posts Joined 06/12
26 Jan 2015
Cast VARCHAR to INTEGER works

Hi...
I'm running this query: 
SEL CAST(CAST('99--,-25--1'AS VARCHAR(15)) AS INTEGER)
I would hope that the query fails, but it works, the resulset is: 99251.
 
I'm working with TD14 and TD12.
Regards!!
 

david.craig 73 posts Joined 05/13
26 Jan 2015

The embedded dashes are allowed unless the number is signed. The comma is allowed because it probably is the GroupSeparator in the SDF. For more details on the parsing rules, see the character-to-numeric conversion section of the SQL Functions reference manual.

--Dave
 

You must sign in to leave a comment.