Solved

set table column default value in management studio

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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

749 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