arrow_backwardBack to SQL Server code examples

SQL Server Full Alter Table Example

A SQL Server example for changing, adding, and removing columns for an existing table
ALTER TABLE
  [dbo].[users]
ADD
  [last_name] varchar(255) NULL;
ALTER TABLE
  [dbo].[users] DROP COLUMN [favorite_color];
ALTER TABLE
  [dbo].[users]
ALTER COLUMN
  [birthdate] varchar(255) NULL;
ALTER TABLE
  [dbo].[users]
ADD
  DEFAULT 'The Kid Next Door' FOR [best_friend];

Using Beekeeper Studio?

Beekeeper Studio is a free and open source database manager for Windows, Mac, and Linux.

This feature is baked right in, so there's no need to manually type SQL every time. Access table column editing by right-clicking on a table in the sidebar and clicking 'View Structure'.

Download Beekeeper Studio