SHARE
TWEET

Untitled

a guest Aug 20th, 2019 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. CREATE SEQUENCE [dbo].[BikePartIdHelper]
  2.  AS [int]
  3.  START WITH 1
  4.  INCREMENT BY 1
  5.  MINVALUE 0
  6.  MAXVALUE 2147483647
  7.  CACHE
  8.  
  9. GO    
  10.  
  11. CREATE TABLE [dbo].[BikeParts](
  12.     [ID] [int] IDENTITY(1,1) NOT NULL,
  13.     [BikeParts_GUID]  AS ((replace(CONVERT([varchar](10),getdate(),(101)),'/','')+replace(CONVERT([varchar],getdate(),(8)),':',''))+right(replicate('0',(4))+CONVERT([varchar],[BikePart_ID]),(4))) PERSISTED,
  14.     [BikePart_ID] [int] NOT NULL,
  15.     [BikePart_Name] [varchar](100) NULL,
  16.  CONSTRAINT [PK_BikeParts] PRIMARY KEY CLUSTERED
  17. (
  18.     [ID] ASC
  19. )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
  20. ) ON [PRIMARY]
  21.  
  22. GO
  23.  
  24. ALTER TABLE [dbo].[BikeParts] ADD  DEFAULT (NEXT VALUE FOR [dbo].[BikePartIdHelper]) FOR [BikePart_ID]
  25.  
  26. GO
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top