About 51 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 ...

    SQL-script: How to write ALTER statements to set Primary key on an existing table? Asked 13 years, 5 months ago Modified 1 year, 8 months ago Viewed 1.1m times

  3. Altering column size in SQL Server - Stack Overflow

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

  4. sql - Altering a column to be nullable - Stack Overflow

    Mar 6, 2016 · SQLite The ALTER TABLE command is a bit special. There is no possibility to modify a column. You have to create a new column, migrate the data, and then drop the column: -- 1. First …

  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. Alter table add multiple columns ms sql - Stack Overflow

    Jul 8, 2016 · Alter table add multiple columns ms sql Asked 15 years, 10 months ago Modified 1 year ago Viewed 512k times

  7. sql - How to alter column nvarchar length without drop - Stack Overflow

    Aug 24, 2017 · ALTER TABLE Post ALTER COLUMN Body nvarchar(8000) NOT NULL; The column is defined as nvarchar (4000) and it gives me this error: Msg 2717, Level 16, State 2, Line 1 The size …

  8. 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)

  9. sql server - Altering a column: null to not null - Stack Overflow

    Mar 27, 2009 · ALTER TABLE tablename MODIFY columnname datatype NOT NULL; Otherwise abatichev's answer seemed good. You can't repeat the alter - it complains (at least in SQL …

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