Friday, 19 February 2016

How to add Columns to an Existing table in SQL Server

Adding a new column to an existing table with data is always tricky. You need to know what data is there, how much data is there, to gauge how long your query is gonna take to complete in production. Also, you cannot add NOT NULL columns into an existing table if they are not empty and you don't have a default value specified. If you know SQL then you probably know that you can add columns to an existing table in SQL Server using ALTER command. It not only allows you to add a column but to drop columns as well. You can also add or drop constraints using ALTER command. Btw, you need to be careful while doing anything with existing tables because of data inside, which presents some challenges while adding new columns or dropping existing ones.
Read more »

No comments:

Post a Comment