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