015_RegionStore.sql 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. BEGIN TRANSACTION
  2. CREATE TABLE dbo.Tmp_primitems
  3. (
  4. itemID uniqueidentifier NOT NULL,
  5. primID uniqueidentifier NULL,
  6. assetID uniqueidentifier NULL,
  7. parentFolderID uniqueidentifier NULL,
  8. invType int NULL,
  9. assetType int NULL,
  10. name varchar(255) NULL,
  11. description varchar(255) NULL,
  12. creationDate varchar(255) NULL,
  13. creatorID uniqueidentifier NULL,
  14. ownerID uniqueidentifier NULL,
  15. lastOwnerID uniqueidentifier NULL,
  16. groupID uniqueidentifier NULL,
  17. nextPermissions int NULL,
  18. currentPermissions int NULL,
  19. basePermissions int NULL,
  20. everyonePermissions int NULL,
  21. groupPermissions int NULL,
  22. flags int NOT NULL DEFAULT ((0))
  23. ) ON [PRIMARY]
  24. IF EXISTS(SELECT * FROM dbo.primitems)
  25. EXEC('INSERT INTO dbo.Tmp_primitems (itemID, primID, assetID, parentFolderID, invType, assetType, name, description, creationDate, creatorID, ownerID, lastOwnerID, groupID, nextPermissions, currentPermissions, basePermissions, everyonePermissions, groupPermissions, flags)
  26. SELECT CONVERT(uniqueidentifier, itemID), CONVERT(uniqueidentifier, primID), CONVERT(uniqueidentifier, assetID), CONVERT(uniqueidentifier, parentFolderID), invType, assetType, name, description, creationDate, CONVERT(uniqueidentifier, creatorID), CONVERT(uniqueidentifier, ownerID), CONVERT(uniqueidentifier, lastOwnerID), CONVERT(uniqueidentifier, groupID), nextPermissions, currentPermissions, basePermissions, everyonePermissions, groupPermissions, flags FROM dbo.primitems WITH (HOLDLOCK TABLOCKX)')
  27. DROP TABLE dbo.primitems
  28. EXECUTE sp_rename N'dbo.Tmp_primitems', N'primitems', 'OBJECT'
  29. ALTER TABLE dbo.primitems ADD CONSTRAINT
  30. PK__primitems__0A688BB1 PRIMARY KEY CLUSTERED
  31. (
  32. itemID
  33. ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
  34. CREATE NONCLUSTERED INDEX primitems_primid ON dbo.primitems
  35. (
  36. primID
  37. ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
  38. COMMIT