TRY_TO_TIMESTAMP_NTZ will try to determine the format based on the first data it encounters. When there is only one row containing int, eg. ‘99997’, it assumes it’s a number of seconds from the beginning of the epoch, and expects all rows to have the same type of value. But if first row contains actual date, the result will be different:
select TRY_TO_TIMESTAMP_NTZ( $1 ) from values
('99997'), -- will return 1970-01-02T03:46:37Z
('2021-04-05 10:00'); -- will return null
select TRY_TO_TIMESTAMP_NTZ( $1 ) from values
('2021-04-05 10:00'),
('99997'); -- will return null