Search This Blog

Thursday, June 27, 2013

Alter SQL Server Examples

SQL Server > DDL > Alter

Alter Table

Modifies a table definition by altering, adding, or dropping columns and constraints.

Examples:


  • Add new column to a table

    ALTER TABLE dbo.TABLE_NAME ADD FIELD_NAME nvarchar(MAX) NULL




ALTER LOGIN

Changes the properties of a SQL Server login account. Examples:    1.Change user password       ALTER LOGIN sa WITH PASSWORD = 'your_password';    2.Enable user       ALTER LOGIN sa ENABLE;