Quantcast
Channel: Teradata Forums - All forums
Viewing all articles
Browse latest Browse all 27759

validate whether cast will work or not - response (2) by monschke

$
0
0

isNum is not enough.  My starting point is strings, but I want to be able to convert to any data type without the SQL blowing up (can only do by removng bad records first - why I want the function).   Here are a couple of examples that fail too (numeric overflow, then bad date, I am sure there are others).
select cast('100000' as SMALLINT);
select cast('2013-23-03' as DATE);
Maybe there is no way, but just checking.  If you wanted to implement ELT approach and always loaded data as strings with TPT, this type of function would seem necessary for data type validations (main reason I am asking).  Thanks.


Viewing all articles
Browse latest Browse all 27759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>