Top "Alter-table" questions

The "ALTER TABLE" is a SQL statement that allows you to make schema changes to a database table (i.e. add, drop or alter columns from an existing table).

Check if a temporary table exists and delete if it exists before creating a temporary table

I am using the following code to check if the temporary table exists and drop the table if it exists …

sql-server sql-server-2005 temp-tables alter-table
Altering a column: null to not null

I have a table that has several nullable integer columns. This is undesirable for several reasons, so I am looking …

sql-server tsql null alter-table alter-column
Rename column SQL Server 2008

I am using SQL Server 2008 and Navicat. I need to rename a column in a table using SQL. ALTER TABLE …

sql sql-server sql-server-2008 alter-table
Adding an identity to an existing column

I need to change the primary key of a table to an identity column, and there's already a number of …

sql sql-server alter-table identity-column
How to delete a column from a table in MySQL

Given the table created using: CREATE TABLE tbl_Country ( CountryId INT NOT NULL AUTO_INCREMENT, IsDeleted bit, PRIMARY KEY (CountryId) ) …

mysql ddl alter-table
Altering column size in SQL Server

How to change the column size of the salary column in the employee table from numeric(18,0) to numeric(22,5)

sql sql-server database tsql alter-table
How do you change the datatype of a column in SQL Server?

I am trying to change a column from a varchar(50) to a nvarchar(200). What is the SQL command to alter …

sql-server tsql type-conversion alter-table
Error renaming a column in MySQL

How do I rename a column in table xyz? The columns are: Manufacurerid, name, status, AI, PK, int I want …

mysql database alter-table mysql-error-1025
SQL Server add auto increment primary key to existing table

As the title, I have an existing table which is already populated with 150000 records. I have added an Id column (…

sql-server sql-server-2008 primary-key alter-table
Rails: How can I rename a database column in a Ruby on Rails migration?

I wrongly named a column hased_password instead of hashed_password. How do I update the database schema, using migration …

ruby-on-rails ruby-on-rails-3 migration rename alter-table