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

Total Post:117

Points:821

 1748  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

Please check, If you want to make this post sponsored

You are not a Sponsored Member. Click Here to Subscribe the Membership.