Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8501401
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T01:12:11+00:00 2026-06-11T01:12:11+00:00

INSERT INTO table_name (column1, column2, column3,…) VALUES (value1, value2, value3,…) Now what to check:

  • 0
INSERT INTO table_name (column1, column2, column3,...)
VALUES (value1, value2, value3,...)

Now what to check:

If inserted value1 = null, change it to 0

How to do it via trigger? I googled for examples and I have never ever done a trigger, so it is rather confusing.

So far got only this:

CREATE TRIGGER testTrigger
ON myTable
AFTER INSERT, UPDATE, DELETE
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T01:12:13+00:00Added an answer on June 11, 2026 at 1:12 am

    You can add default value . This is how it’s done for a new column. For existing one you should add constraint. Check Update 2

    ALTER TABLE table_name 
    ADD column1 int NOT NULL DEFAULT(0)
    

    Add a column with a default value to an existing table in SQL Server

    UPDATE:

    To set default value, you should update NULL values at first.

    UPDATE table_name 
    SET column1 = 0
    WHERE column1 IS NULL
    

    UPDATE 2:

    Try adding constraint

    ALTER TABLE table_name 
    ADD CONSTRAINT DF_column1 DEFAULT 0 FOR column1 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following query: INSERT INTO table (a, b, c) VALUES (NOW(), NOW()
I need to handle the ORA-01400 error (cannot insert NULL into (SCHEMA.TABLE_NAME.COLUMN_NAME) ) using
I do the following INSERT INTO 'tablename' SELECT 'data1' AS 'column1', 'data2' AS 'column2'
In MySQL you can insert multiple rows like this: INSERT INTO 'tablename' ('column1', 'column2')
Just experimenting I've used this query on MySQL: insert into table_name (text_col) values (1919191919191919191919191...91919191)
What is main difference between INSERT INTO table VALUES .. and INSERT INTO table
I have a multi-row insert that looks something like: insert into table VALUES (1,
I have the following query in VBA: DoCmd.RunSQL INSERT INTO table (value) VALUES ('example')
I have some problem whith such mysql_query INSERT INTO table VALUES ('', CURDATE()-1) why
INSERT INTO table('name') VALUES(abc) IF NOT EXISTS name='abc' If abc doesn't exist in the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.