1
0

009_EstateStore.sql 699 B

123456789101112131415161718192021222324
  1. BEGIN TRANSACTION
  2. CREATE TABLE dbo.Tmp_estate_map
  3. (
  4. RegionID uniqueidentifier NOT NULL DEFAULT ('00000000-0000-0000-0000-000000000000'),
  5. EstateID int NOT NULL
  6. ) ON [PRIMARY]
  7. IF EXISTS(SELECT * FROM dbo.estate_map)
  8. EXEC('INSERT INTO dbo.Tmp_estate_map (RegionID, EstateID)
  9. SELECT CONVERT(uniqueidentifier, RegionID), EstateID FROM dbo.estate_map WITH (HOLDLOCK TABLOCKX)')
  10. DROP TABLE dbo.estate_map
  11. EXECUTE sp_rename N'dbo.Tmp_estate_map', N'estate_map', 'OBJECT'
  12. ALTER TABLE dbo.estate_map ADD CONSTRAINT
  13. PK_estate_map PRIMARY KEY CLUSTERED
  14. (
  15. RegionID
  16. ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
  17. COMMIT