Skip to content

Instantly share code, notes, and snippets.

@jibinpb
Created August 1, 2018 05:15
Show Gist options
  • Save jibinpb/d493230b386ee98df614fd749816fbef to your computer and use it in GitHub Desktop.
Save jibinpb/d493230b386ee98df614fd749816fbef to your computer and use it in GitHub Desktop.
SQL Server GDB - Create Node And Edge Tables
IF OBJECT_ID('dbo.Entity', 'U') IS NOT NULL
DROP TABLE dbo.Entity
GO
-- Create Entity as NODE table
CREATE TABLE dbo.Entity
(
[ID] INTEGER PRIMARY KEY IDENTITY,
[Name] VARCHAR(100) NOT NULL,
[Code] VARCHAR(100) NULL,
[Type] VARCHAR(100) NOT NULL
)
AS NODE
GO
IF OBJECT_ID('dbo.Subsidiaries', 'U') IS NOT NULL
DROP TABLE dbo.Subsidiaries
GO
-- Create Subsidiaries as Edge table
CREATE TABLE dbo.Subsidiaries
(
HoldingPercentage DECIMAL(5,2),
EffectiveDate DATE
) AS EDGE;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment