Pandas → T-SQL › astype

Pandas astype to CAST / TRY_CONVERT

astype fails the series on junk. TRY_CONVERT fails the cell. Prefer TRY on client files.

TRY_CONVERT(int, customer_id)

datetime64 is TRY_CONVERT(datetime2, col). date is CAST(... AS date) after it parsed.

Canonical translation

TRY_CONVERT(int, customer_id)

Then write it on a ticket

Monday is free. A colleague asks, you type, we mark it.

Clock in free