Advertise with us

How to set default value for all tables column in SQL Server?

Posted by  jayprakash sharma
 1858  View(s)
Ratings:
Rate this:
Hi!

How to set default value for all tables column in SQL Server?

If it is string it will empty and if it is int in already created table.

Thanks in advance!
  1. Re: How to set default value for all tables column in SQL Server?

    Hi Jayprakash!


    Add DEFAULT constraint

    Here is the way to do it:

    CREATE TABLE Persons
    (
    id int NOT NULL,
    LName varchar(25) NOT NULL,
    FName varchar(25),
    Addr varchar(255),
    City varchar(255) DEFAULT 'Hawaii'
    )

    I hope it solve your problem!

      Modified On Mar-30-2018 12:37:45 AM

Answer