Skip to main content
100%

Gist 79872f318f741408f6c6a418c5104465

✓ Published0🌍 Public
Aabonello
Last edited Mar 15, 2026
Created on Mar 15, 2026

This example demonstrates how to modify a SQL Server table schema by converting the `Status` column from a bit data type to an NVARCHAR(50) field with a default value of 'Pending'. It shows the process of dropping the existing default constraint, altering the column type, and then re-adding a new constraint. The code uses SQL Server T-SQL commands such as `ALTER TABLE`, `DROP CONSTRAINT`, and `ADD CONSTRAINT` to achieve the migration. The example is based on a gist by abonello and references the `Orders` table from a SalesDB database, highlighting the foreign key relationship with the `Customers` table.

AI-generated description

Similar vizzes