Quantcast
Viewing latest article 8
Browse Latest Browse All 91

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

In SQL Server, you can use below template:

ALTER TABLE {tablename}ADD     {columnname} {datatype} DEFAULT {default_value}

For example, to add a new column [Column1] of data type int with default value = 1 into an existing table [Table1] , you can use below query:

ALTER TABLE [Table1]ADD     [Column1] INT DEFAULT 1

Viewing latest article 8
Browse Latest Browse All 91

Trending Articles



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