HOW TO SET DEFAULT VALUE FOR ALL TABLES COLUMN IN SQL SERVER?

jayprakash sharma

Total Post:117

Points:821
Posted by  jayprakash sharma
 1172  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. AVADHESH PATEL

    Post:604

    Points:4228
    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!

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!