Cast VARCHAR to INTEGER works

Database
Teradata Employee

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!!

1 REPLY
Teradata Employee

Re: Cast VARCHAR to INTEGER works

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