Login | Register   
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language:
Expertise: Beginner
Jan 20, 2000

Set a Column's Default Value As Part of the Create Table

In SQL Server, a column's default value can be specified as part of the Create Table statement. This default value will be set for the specified column in cases where an insert is performed but this column's value is not set. The given example sets this default as 'MyDefaultValue' for name column.

Example:

  
Create Table MyTable
(id int not null,
name char(50) default  'MyDefaultValue')
Jai Bardhan
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap