?
Solved

set table column default value in management studio

Posted on 2012-04-03
3
Medium Priority
?
642 Views
Last Modified: 2012-04-03
I'm adding a new column to an existing table, and I would like to set a default value for this new added column in SQL server 2005 management studio. How should I set it, and how do I set it graphically? Thanks.
0
Comment
Question by:minglelinch
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 3

Accepted Solution

by:
Chris__W earned 1000 total points
ID: 37802253
Hello,

In SSMS for SQL 2005:
Right click on the created table and select Modify.
In the upper pane, click on the Column you wish to add a default for.
In the lower pane, type the default value (or the name of the constraint) into the field labled "Default Value or Binding".
Save and Close the tab.

This will not update existing records without running an Update statement against the records.

-Chris
0
 
LVL 15

Assisted Solution

by:Deepak Chauhan
Deepak Chauhan earned 1000 total points
ID: 37802408
Right click on table and select modify now you have   column name and data types of that table then click on the existing column and look at in lower pane which is column property
in the general block of column property forth option is "default value or binding"
please write a default value whatever you want int he right hand side and finally save the table .

OR  run the script

alter table [dbo].[Table_1] add abc varchar(222)  null constraint def_abc Default(('abc'))
0
 
LVL 1

Author Closing Comment

by:minglelinch
ID: 37803585
Thanks a lot.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question