Quantcast
Channel: How to add a column with a default value to an existing table in SQL Server? - Stack Overflow
Viewing all articles
Browse latest Browse all 91

Answer by Laxmi for How to add a column with a default value to an existing table in SQL Server?

$
0
0

First create a table with name student:

CREATE TABLE STUDENT (STUDENT_ID INT NOT NULL)

Add one column to it:

ALTER TABLE STUDENT ADD STUDENT_NAME INT NOT NULL DEFAULT(0)SELECT * FROM STUDENT

The table is created and a column is added to an existing table with a default value.

Image 1


Viewing all articles
Browse latest Browse all 91

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>