0

我一直在一個項目,我有一個計算列的表。當我開始同步,它說:不包括Sql Server計算列從同步

The column "TotalAmount" cannot be modified because it is either a computed column or is the result of a UNION operator 

我想排除此列是同步。

我正在使用C#和Sql Server 2008 R2。

表定義:

CREATE TABLE [dbo].[tblFeeDetails](
    [RecordId] [bigint] IDENTITY(1,1) NOT NULL, 
    [SessionId] [int] NOT NULL, 
    [CourseId] [int] NOT NULL, 
    [FormNumber] [nvarchar](50) NOT NULL, 
    [CourseFee] [money] NOT NULL, 
    [OtherCharges] [money] NOT NULL, 
    [LateFee] [money] NOT NULL, 
    [TotalAmount] AS (([CourseFee]+[OtherCharges])+[LateFee]) PERSISTED, 
    [Status] [bit] NOT NULL 
) 
+0

你能給我們表或視圖的定義嗎? – bvdb

+0

@bvdb請檢查我的編輯 –

+0

有沒有人在stackoverflow誰可以回答這個問題? –

回答

0

您使用SqlSyncAdapterBuilder,是否正確?使用它,您可以指定要跟蹤的列。

+0

否@Greg,我正在使用SqlSyncScopeProvisioning,DbSyncScopeDescription和SyncOrchestrator同步我的數據庫。除了具有計算列的表以外,一切都會正常進行 –

+0

@SarbjitSingh你應該把這些信息放在問題的標題或描述中。如果你的問題更具體,你會吸引更多的答案。給人們很多技術細節,他們會更加想要幫助你。 (只是試圖幫助) – bvdb

0

我假設您使用GetDescriptionForTable來檢索模式。

從表描述列集合,你可以,刪除列,或者你可以手動指定哪些列要包含在GetDescriptionForTable ...

例如,

//定義爲CustomerContact,包括要包含的列的列表。 Collection columnsToInclude = new Collection();

columnsToInclude.Add(「CustomerId」);

columnsToInclude.Add(「PhoneType」); DbSyncTableDescription customerContactDescription = SqlSyncDescriptionBuilder.GetDescriptionForTable(「Sales.CustomerContact」,columnsToInclude,serverConn);其中,

+0

我用上面提到的方式...但仍然收到相同的錯誤。 –

+0

你有沒有取消配置和重新配置範圍? – JuneT

+0

是的,我做了,但希望... –