About 53 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. sql server - SQL-script: How to write ALTER statements to set Primary ...

    The table already has an existing compound-key [PersonId, Pname] as the primary key. Now I want to modify that existing compound-key to have one more field [PMid].

  3. 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...

  4. 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 …

  5. How to ALTER multiple columns at once in SQL Server

    Jan 24, 2015 · I need to ALTER the data types of several columns in a table. For a single column, the following works fine: ALTER TABLE tblcommodityOHLC ALTER COLUMN …

  6. How do you change the datatype of a column in T-SQL Server?

    Mar 9, 2009 · I am trying to change a column from a varchar(50) to a nvarchar(200). What is the SQL command to alter this table?

  7. 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 …

  8. alter table - Adding column between two other columns in SQL server ...

    Mar 16, 2011 · Can you add a column to a table inserting it in between two existing columns in SQL Server without dropping and re-creating the table?

  9. How do I alter the precision of a decimal column in Microsoft SQL ...

    Sep 23, 2008 · Is there a way to alter the precision of an existing decimal column in Microsoft SQL Server?

  10. How to add 'ON DELETE CASCADE' in ALTER TABLE statement

    I have a foreign key constraint in my table, I want to add ON DELETE CASCADE to it. I have tried this: alter table child_table_name modify constraint fk_name foreign key (child_column_name)