Hi everybody.
Does anyone know if it is possible to add a formula field as column of a
replicated table?
How can I do it?
Thanks,
Marco
You can add a formula column the same as would if you added a non-formula
column to a published table. See BOL topic Schema Changes on Publication
Databases for more details.
To add columns to an article
1. In SQL Server Enterprise Manager, under Replication, expand Publications
and then right-click the publication where you want to modify a schema.
2. Click Properties, click Filter Columns, and then click Add Column.
3. In the Add Column to Replicated Table dialog box, enter the name of the
column and the SQL syntax that defines the column. For example if I want
to add a new formula column with a value of 10 greater than an existing
column col1, the SQL syntax should be: "AS ([col1] + 10)" . (For
information about the syntax required to define the column, see the
Transact-SQL ALTER TABLE statement)
4. In the Add Column to Replicated Table dialog box, select the
publications to which you want to add the column.
Fany Vargas
Microsoft Corporation
This posting is provided "AS IS" with no warranties, and confers no rights.
Are you secure? For information about the Strategic Technology Protection
Program and to order your FREE Security Tool Kit, please visit
http://www.microsoft.com/security.
Microsoft highly recommends that users with Internet access update their
Microsoft software to better protect against viruses and security
vulnerabilities. The easiest way to do this is to visit the following
websites:
http://www.microsoft.com/protect
http://www.microsoft.com/security/guidance/default.mspx
|||Try something like:
sp_repladdcolumn @.source_object = 'tablename',
@.column = 'columnname',
@.typetext = ' as (ID + 1)'
I just used this on a test system where ID is an existing column and it was
added on the publisher and subscriber (through synchronization) fine.
Rgds,
Paul Ibison SQL Server MVP, www.replicationanswers.com
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)
No comments:
Post a Comment