About 9,110,000 results
Open links in new tab
  1. 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?

  2. How to add a column with a default value to an existing table in …

    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 …

  3. sql server - SQL-script: How to write ALTER statements to set …

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

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

  5. Change primary key column in Microsoft SQL Server

    SELECT * from history WHERE id is NULL <---- This shows 0 results ALTER TABLE history ALTER COLUMN id int NOT NULL ALTER TABLE history ADD PRIMARY KEY (id) ALTER …

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

  7. sql - Changing the maximum length of a varchar column? - Stack …

    Jan 12, 2012 · In Microsoft SQL Server Management Studio, you can also right-click a table and select "Design" to open the design view. From here you are presented with a list of each …

  8. Change a Nullable column to NOT NULL with Default Value

    ALTER TABLE dbo.MyTable ALTER COLUMN Created DATETIME NOT NULL Is there any way to also specify the default value as well on the ALTER statement?

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

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