• It is very possible the problem is the connection settings, most likely ARITHABORT, which SSMS sets to ON, but SQLCMD sets to OFF.
    Microsoft says this should always be set to ON, as it is in SSMS, even though for .Net and other applications the default is OFF:
    https://docs.microsoft.com/en-us/sql/t-sql/statements/set-arithabort-transact-sql 

    You can configure an instance to default all connections to ARITHABORT ON using the server properties, connections page, arithmetic abort setting:
    https://docs.microsoft.com/en-us/sql/database-engine/configure-windows/server-properties-connections-page