1
0

006_EstateStore.sql 633 B

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