1
0

005_EstateStore.sql 642 B

12345678910111213141516171819202122
  1. BEGIN TRANSACTION
  2. CREATE TABLE dbo.Tmp_estate_groups
  3. (
  4. EstateID int NOT NULL,
  5. uuid uniqueidentifier NOT NULL
  6. ) ON [PRIMARY]
  7. IF EXISTS(SELECT * FROM dbo.estate_groups)
  8. EXEC('INSERT INTO dbo.Tmp_estate_groups (EstateID, uuid)
  9. SELECT EstateID, CONVERT(uniqueidentifier, uuid) FROM dbo.estate_groups WITH (HOLDLOCK TABLOCKX)')
  10. DROP TABLE dbo.estate_groups
  11. EXECUTE sp_rename N'dbo.Tmp_estate_groups', N'estate_groups', 'OBJECT'
  12. CREATE NONCLUSTERED INDEX IX_estate_groups ON dbo.estate_groups
  13. (
  14. EstateID
  15. ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
  16. COMMIT