Sql insert null instead of 0




















For all helpful answers below, please indicate this by clicking on the thumbs up next to those answers. If any one answer lead to a solution, please indicate this by clicking on the check mark next that answer.

As for how to do your null-to-zero conversion Given that you've ruled out changing the insertion procedures, and changing the display procedures which would allow us to use a view or computed columns to allow you to keep the original data but display based on the altered data , that really only leaves one option - change the data either as it is added, or when the job is done. But you knew this. Write an Answer. Write an Answer Hint: Notify or tag a user in this post by typing username.

Why the age column just doesn't remain empty or NULL? How can I set a default value, so that it just remains empty, when no value is specified while inserting? Since the column is of type int the DB tries to convert the string '' to a number. That would be 0. Just use null instead of '' if you don't have a value. That is what null is for. Stack Overflow for Teams — Collaborate and share knowledge with a private group.

Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. Null or empty instead of 0 Ask Question. Asked 5 years, 8 months ago. Active 5 years, 8 months ago.

Email Address:. Feeds: Posts Comments. Rate this:. Like this: Like Loading Leave a Reply Cancel reply Enter your comment here Fill in your details below or click an icon to log in:. Email required Address never made public. Name required. Find us on Facebook.



0コメント

  • 1000 / 1000