Activity overview
Latest activity by Ivailo
4. Compare again. Should see [AddedColumn] as a new column that have to be transferred. Everything is correct. Deploy changes with SQL Compare. Everything should be transferred, but... 5. Compare again. Unfortunately PERIOD and HIDDEN attributes are missing in DB2. OK, deploy again with SQL Compare. 6. Compare again. Should see PERIOD is transferred but HIDDEN attribute is missing. Ok, deploy again with SQL Compare. Now you should see the error:
Failed to run SQL: Period column 'sysValidFrom' in a system-versioned temporal table cannot be altered.
Error executing the following SQL: ALTER TABLE [dbo].[DemoTable] ALTER COLUMN [sysValidFrom] [datetime2] GENERATED ALWAYS AS ROW START HIDDEN NOT NULL I think the correct command should be: ALTER TABLE [dbo].[DemoTable] ALTER COLUMN sysValidFrom ADD HIDDEN
But, I prefer all changes to be deployed at once instead of 3 steps.
/ comments
4. Compare again. Should see [AddedColumn] as a new column that have to be transferred.Everything is correct.Deploy changes with SQL Compare.Everything should be transferred, but...5. Compare again...
2. Transfer the table to DB2 with SQL Compare. Everything should be fine. 3. Apply some changes to the table. For example with SQL Management Studio insert a new column [AddedColumn] between [Description] and [sysValidFrom] in DB1.dbo.DemoTable and fix PERIOD and HIDDEN manually. Like the following simplified script: ALTER TABLE dbo.DemoTable DROP CONSTRAINT DF_dbo_DemoTable_sysValidFrom, CONSTRAINT DF_dbo_DemoTable_sysValidTo, CONSTRAINT PK_DemoTable
CREATE TABLE dbo.Tmp_DemoTable
(
Id int NOT NULL IDENTITY (1, 1) CONSTRAINT PK_DemoTable PRIMARY KEY CLUSTERED ( Id ),
Description nvarchar(50) NOT NULL,
AddedColumn int NOT NULL,
sysValidFrom datetime2 GENERATED ALWAYS AS ROW START HIDDEN NOT NULL CONSTRAINT [DF_dbo_DemoTable_sysValidFrom] DEFAULT SYSUTCDATETIME(),
sysValidTo datetime2 GENERATED ALWAYS AS ROW END HIDDEN NOT NULL CONSTRAINT [DF_dbo_DemoTable_sysValidTo] DEFAULT CONVERT(DATETIME2, '9999-12-31 23:59:59.99999999'),
PERIOD FOR SYSTEM_TIME (sysValidFrom, sysValidTo)
)
DROP TABLE dbo.DemoTable
EXECUTE sp_rename N'dbo.Tmp_DemoTable', N'DemoTable', 'OBJECT' / comments
2. Transfer the table to DB2 with SQL Compare. Everything should be fine.3. Apply some changes to the table. For example with SQL Management Studio insert a new column [AddedColumn] between [Descri...
Hello, Ok, I will try to explain how to reproduce the issue in more detail with an example: (excuse me, but I will post step by step to avoid problems) create a table in DB1 with the following script: CREATE TABLE [dbo].[DemoTable](
[Id] [int] IDENTITY(1,1) NOT NULL CONSTRAINT PK_DemoTable PRIMARY KEY CLUSTERED (Id),
[Description] [nvarchar](50) NOT NULL,
sysValidFrom datetime2 GENERATED ALWAYS AS ROW START HIDDEN NOT NULL CONSTRAINT [DF_dbo_DemoTable_sysValidFrom] DEFAULT SYSUTCDATETIME(),
sysValidTo datetime2 GENERATED ALWAYS AS ROW END HIDDEN NOT NULL CONSTRAINT [DF_dbo_DemoTable_sysValidTo] DEFAULT CONVERT(DATETIME2, '9999-12-31 23:59:59.99999999'),
PERIOD FOR SYSTEM_TIME (sysValidFrom, sysValidTo)
)
GO
/ comments
Hello,Ok, I will try to explain how to reproduce the issue in more detail with an example:(excuse me, but I will post step by step to avoid problems)create a table in DB1 with the following script:...
Oh, I am sorry. I tried to edit the post and now it is missing. I will try to repost tomorrow. / comments
Oh, I am sorry. I tried to edit the post and now it is missing.I will try to repost tomorrow.
Excuse me, but may be something is wrong in the previous post. I entered 10 points in the "Ordered list" and in "Edit" mode I can see 10 points, but in "Preview" mode I can see only 8 points and some scripts are missing. I am not sure how to fix this. / comments
Excuse me, but may be something is wrong in the previous post. I entered 10 points in the "Ordered list" and in "Edit" mode I can see 10 points, but in "Preview" mode I can see only 8 points and so...