019_RegionStore.sql 609 B

12345678910111213141516171819
  1. BEGIN TRANSACTION
  2. CREATE TABLE dbo.Tmp_regionban
  3. (
  4. regionUUID uniqueidentifier NOT NULL,
  5. bannedUUID uniqueidentifier NOT NULL,
  6. bannedIp varchar(16) NOT NULL,
  7. bannedIpHostMask varchar(16) NOT NULL
  8. ) ON [PRIMARY]
  9. IF EXISTS(SELECT * FROM dbo.regionban)
  10. EXEC('INSERT INTO dbo.Tmp_regionban (regionUUID, bannedUUID, bannedIp, bannedIpHostMask)
  11. SELECT CONVERT(uniqueidentifier, regionUUID), CONVERT(uniqueidentifier, bannedUUID), bannedIp, bannedIpHostMask FROM dbo.regionban WITH (HOLDLOCK TABLOCKX)')
  12. DROP TABLE dbo.regionban
  13. EXECUTE sp_rename N'dbo.Tmp_regionban', N'regionban', 'OBJECT'
  14. COMMIT