Solved

set table column default value in management studio

Posted on 2012-04-03
3
626 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 250 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 250 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

Raise the IQ of Your IT Alerts

From IT major incidents to manufacturing line slowdowns, every business process generates insights that need to reach the people required to take action. You need a platform that integrates with your business tools to create fully enabled DevOps toolchains.

You need xMatters.

Question has a verified solution.

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

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

717 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