1
0

007_EstateStore.sql 810 B

12345678910111213141516171819202122232425
  1. BEGIN TRANSACTION
  2. CREATE TABLE dbo.Tmp_estateban
  3. (
  4. EstateID int NOT NULL,
  5. bannedUUID uniqueidentifier NOT NULL,
  6. bannedIp varchar(16) NULL,
  7. bannedIpHostMask varchar(16) NULL,
  8. bannedNameMask varchar(64) NULL
  9. ) ON [PRIMARY]
  10. IF EXISTS(SELECT * FROM dbo.estateban)
  11. EXEC('INSERT INTO dbo.Tmp_estateban (EstateID, bannedUUID, bannedIp, bannedIpHostMask, bannedNameMask)
  12. SELECT EstateID, CONVERT(uniqueidentifier, bannedUUID), bannedIp, bannedIpHostMask, bannedNameMask FROM dbo.estateban WITH (HOLDLOCK TABLOCKX)')
  13. DROP TABLE dbo.estateban
  14. EXECUTE sp_rename N'dbo.Tmp_estateban', N'estateban', 'OBJECT'
  15. CREATE NONCLUSTERED INDEX IX_estateban ON dbo.estateban
  16. (
  17. EstateID
  18. ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
  19. COMMIT