Guest User

Untitled

a guest
Oct 18th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 1.05 KB | None | 0 0
  1. SET ANSI_NULLS ON
  2. GO
  3. SET QUOTED_IDENTIFIER ON
  4. GO
  5.  
  6. DECLARE @localized_string_AddRole_Failed nvarchar(256)
  7. SET @localized_string_AddRole_Failed = N'Failed adding the ''persistenceUsers'' role'
  8.  
  9. DECLARE @ret INT, @Error INT
  10. IF NOT EXISTS( SELECT 1 FROM [dbo].[sysusers] WHERE name=N'persistenceUsers' AND issqlrole=1 )
  11.  BEGIN
  12.  
  13.     EXEC @ret = sp_addrole N'persistenceUsers'
  14.  
  15.     SELECT @Error = @@ERROR
  16.  
  17.     IF @ret <> 0 OR @Error <> 0
  18.         RAISERROR( @localized_string_AddRole_Failed, 16, -1 )
  19.  END
  20. GO
  21.  
  22. IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[InstanceData]') AND TYPE IN (N'U'))
  23.     DROP TABLE [dbo].[InstanceData]
  24. GO
  25. CREATE TABLE [dbo].[InstanceData](
  26.     [id] [uniqueidentifier] NOT NULL,  
  27.     [instance] [image] NULL,
  28.     [instanceXml] [xml] NULL,
  29.     [created] [datetime] NOT NULL,
  30.     [lastUpdated] [datetime] NOT NULL,
  31.     [lockOwner] [uniqueidentifier] NULL,
  32.     [lockExpiration] [datetime] NULL
  33. ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
  34. GO
  35. CREATE UNIQUE CLUSTERED INDEX id_index
  36.     ON [dbo].[InstanceData] ([id])
  37.     WITH IGNORE_DUP_KEY
  38. GO
Add Comment
Please, Sign In to add comment