Skip to content

Instantly share code, notes, and snippets.

@shaneis
Created July 21, 2017 08:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shaneis/c849161835381c18d4ee3de1c1ddb484 to your computer and use it in GitHub Desktop.
Save shaneis/c849161835381c18d4ee3de1c1ddb484 to your computer and use it in GitHub Desktop.
Old Style Adding Constraints
USE Pantheon;
GO
DROP TABLE IF EXISTS dbo.CreateThenAlter;
CREATE TABLE dbo.CreateThenAlter
(
RBAR char(10)
);
GO
ALTER TABLE dbo.CreateThenAlter ADD CONSTRAINT CHK_CreateThenAlter_RBAR CHECK (RBAR IN ('good', 'bad'));
ALTER TABLE dbo.CreateThenAlter ADD CONSTRAINT DF_CreateThenAlter_RBAR DEFAULT ('good') FOR RBAR;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment