Whatever the issue is, it’s going to be on your sql server, not the app server.
Cast/convert is done in sql directly.