Skip to content

Instantly share code, notes, and snippets.

@tdmitch
Created October 10, 2017 17:04
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 tdmitch/54cbe0e90f8c7170e678ccc8bd67fda4 to your computer and use it in GitHub Desktop.
Save tdmitch/54cbe0e90f8c7170e678ccc8bd67fda4 to your computer and use it in GitHub Desktop.
/* Create base table */
CREATE TABLE [dbo].[Customers](
[CustomerKey] INT NOT NULL IDENTITY(1,1),
[CustomerID] INT NOT NULL,
[CustomerName] VARCHAR(100) NOT NULL,
[CustomerCategory] VARCHAR(50) NULL,
[PrimaryContactPersonID] INT NOT NULL,
[PostalCityID] INT NOT NULL,
[CreditLimit] DECIMAL(18, 2) NULL,
[AccountOpenedDate] DATE NOT NULL,
[StandardDiscountPercentage] DECIMAL(18, 3) NOT NULL,
[IsStatementSent] BIT NOT NULL,
[IsOnCreditHold] BIT NOT NULL,
[PaymentDays] INT NOT NULL,
[PhoneNumber] VARCHAR(20) NOT NULL,
[FaxNumber] VARCHAR(20) NOT NULL,
[WebsiteURL] VARCHAR(256) NOT NULL,
[Address] VARCHAR(60) NOT NULL,
[Address2] VARCHAR(60) NULL,
[PostalCode] VARCHAR(10) NOT NULL,
ValidFrom DATETIME2 GENERATED ALWAYS AS ROW START HIDDEN NOT NULL ,
ValidTo DATETIME2 GENERATED ALWAYS AS ROW END HIDDEN NOT NULL ,
PERIOD FOR SYSTEM_TIME (ValidFrom, ValidTo),
CONSTRAINT PK_Customers PRIMARY KEY (CustomerKey)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment