About 655,000 results
Open links in new tab
  1. How to add a column with a default value to an existing table in SQL ...

    Jun 21, 2016 · ALTER TABLE [dbo.table_name] ADD [Column_Name] BIT NOT NULL Default ( 0 ) Here is another way to add a column to an existing database table with a default value. A much more …

  2. How to DROP multiple columns with a single ALTER TABLE statement …

    Jun 14, 2011 · 409 I would like to write a single SQL command to drop multiple columns from a single table in one ALTER TABLE statement. From MSDN's ALTER TABLE documentation...

  3. How do I rename a column in a database table using SQL?

    Oct 6, 2008 · 155 If I wish to simply rename a column (not change its type or constraints, just its name) in an SQL database using SQL, how do I do that? Or is it not possible? This is for any database …

  4. Add column to SQL Server - Stack Overflow

    Dec 19, 2022 · ALTER TABLE YourTable ADD Bar INT NOT NULL DEFAULT(0) /*Adds a new int column existing rows will be given the value zero*/ In SQL Server 2008 the first one is a metadata …

  5. sql server - Add a new table column to specific ordinal position ...

    83 Is it possible to add a column to a table at a specific ordinal position in SQL Server? For instance, our tables always have CreatedOn, CreatedBy, LastModifiedOn, LastModifiedBy columns at the "end" of …

  6. What is the SQL to change the field length of a table column in SQL ...

    Oct 6, 2017 · 9 The ALTER TABLE Statement The ALTER TABLE statement is used to add, delete, or modify columns in an existing table. SQL ALTER TABLE Syntax To add a column in a table, use the …

  7. sql - Modify table: How to change 'Allow Nulls' attribute from not null ...

    Feb 13, 2016 · How to change one attribute in a table using T-SQL to allow nulls (not null --> null)? Alter table maybe?

  8. sql - How to use ALTER TABLE to add a new column and make it …

    Sep 17, 2010 · My MS SQL Server will allow me to run "ALTER TABLE table_name ADD UNIQUE (column_name)" as many times as I want. If I then go into SQL Management Studio and examine the …

  9. Alter table add multiple columns ms sql - Stack Overflow

    Jul 8, 2016 · Can anyone tell me where is the mistake in the following query ALTER TABLE Countries ADD ( HasPhotoInReadyStorage bit, HasPhotoInWorkStorage bit, HasPhotoInMaterialStorage bit, …

  10. SQL Server add auto increment primary key to existing table

    If your table has relationship with other tables using its primary or foriegen key, may be it is impossible to alter your table. so you need to drop and create the table again.