How to save numeric data as string(varchar) in SQL table?

Hi everyone. I’m facing an issue related to the object of this topic. The application I’m developing is based on postgresql and I have a table for saving enterprises data (name of the company, national code, address, etc…).
When I try to update the data of a record of the enterprise table, where the national code is a numeric code that begins with 0 (so in the DB it is saved as varchar), I get an error of format of that national code data because it begins with 0. When I create a new record of an enterprise and click save, the national code is saved without the initial 0. How can I fix this?

Thanks for the support and I hope I’ve been sufficiently clear.

Hey @Gianluca! Welcome to the Appsmith community.

To answer your question, assuming that you are using a query with prepared statements turned ON, first of all turn it OFF. The next step is to make sure that all the DB values being passed in the queries are in correct format. i.e - for varchar it should be something like - '{{nationalCodeInput.text}}' (Quotes are necessary)

Thanks @pranav for the welcome and the support! I added the quotes and disabled the prepared statements button and everything ran smoothly.