all groups > sql server replication > august 2006 >
You're in the

sql server replication

group:

Replicate less than 255 columns on a table with more than 300 colu


Replicate less than 255 columns on a table with more than 300 colu Gladguy
8/18/2006 7:41:30 AM
sql server replication:
I have a table with around 330 columns. I need only 140 odd columns to be
replicated from this table.

I do the below steps to setup the replication.

1. On the Create Publication wizard, I choose Transactional replication,
choose the subscriber types and specify the article.
2. After giving a name for the Publication, I choose the option that allows
me to specify the data filters.
3. On the Filter Data step, I choose to filter by columns and then remove
those columns that I donot wish to replicate [I remove around 190 columns]
4. I specify the defaults for the remaining options and finish.

Upon finishing this setup, I get the following messages

------------------------------------------------------------------------------------------------
SQL Server Enterprise Manager could not create article "Tab1" based on
object "Tab1". Do you wish to continue saving other changes to the
publication?

Error 20068: The article cannot be created on table '[dbo].[Tab1]' because
it has more than 255 columns
------------------------------------------------------------------------------------------------

If I give Yes for this window, I get another error as

------------------------------------------------------------------------------------------------
SQL Server Enterprise Manager could not save the list of filtered columns in
article 'Tab1' on table 'Tab1'. Do you want to continue savint the changes to
the publication?

Error 20485: [SQL-DMO] This property or method is not availble until the
object (or its parent if appropriate) has been added to the collection.
------------------------------------------------------------------------------------------------

Is there any work around for this problem?

As of my understanding, whatever be the number of columns i am replicating,
the base table should have only 255 columns for replication. Is this a
constraint in SQL 2000? It would be great if some one could confirm or
suggest a workaround.

Re: Replicate less than 255 columns on a table with more than 300 colu Hilary Cotter
8/18/2006 11:09:15 AM
Can you create an indexed view on this table which has only the columns you
want and replicate that?

Other wise could you post the schema and one or two of the columns you do
not which to replicate and I will show you how to do it.

--
Hilary Cotter
Director of Text Mining and Database Strategy
RelevantNOISE.Com - Dedicated to mining blogs for business intelligence.

This posting is my own and doesn't necessarily represent RelevantNoise's
positions, strategies or opinions.

Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html

Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com



[quoted text, click to view]

Re: Replicate less than 255 columns on a table with more than 300 Gladguy
8/19/2006 2:04:29 PM
Thank you Hilary for your reply.

I had already recomended the same workaround to my user and testing the
same. I will update this thread with my results.

Cheers,
Imran.

[quoted text, click to view]
Re: Replicate less than 255 columns on a table with more than 300 Gladguy
8/22/2006 5:25:02 AM
Hi Hilary,

As of my understanding, to replicate a view, I should have the refered table
also included in the Publication.

The table "Tab1" that I want to replicate (contains 330 columns). If I
create an indexed view for the colunms i need (around 190) and replicate it,
it would error out with the following message.

------------------------------------------------------------------------------------------------
Unable to replicate a view or function because the referenced objects or
columns are not present on the Subscriber
------------------------------------------------------------------------------------------------

Can you tell me how to acheive this? You can take the following table as an
example(I have reduced the number of colunms).

CREATE TABLE [dbo].[TAB1] (
[PROJ_ID] [int] NOT NULL ,
[ProjectUniqueID] [int] NOT NULL ,
[TaskUniqueID] [int] NOT NULL ,
[TaskSCost1] [decimal](25, 6) NULL ,
[TaskSCost2] [decimal](25, 6) NULL ,
[TaskSCost3] [decimal](25, 6) NULL ,
[TaskSCost4] [decimal](25, 6) NULL ,
[TaskSCost5] [decimal](25, 6) NULL ,
[TaskSCost6] [decimal](25, 6) NULL ,
[TaskSCost7] [decimal](25, 6) NULL ,
[TaskSCost8] [decimal](25, 6) NULL ,
[TaskSCost9] [decimal](25, 6) NULL ,
[TaskSCost10] [decimal](25, 6) NULL ,
[TaskSCost1Indicator] [smallint] NULL ,
[TaskSCost2Indicator] [smallint] NULL ,
[TaskSCost3Indicator] [smallint] NULL ,
[TaskSCost4Indicator] [smallint] NULL ,
[TaskSCost5Indicator] [smallint] NULL ,
[TaskSCost6Indicator] [smallint] NULL ,
[TaskSCost7Indicator] [smallint] NULL ,
[TaskSCost8Indicator] [smallint] NULL ,
[TaskSCost9Indicator] [smallint] NULL ,
[TaskSCost10Indicator] [smallint] NULL ,
[TaskSDate1] [datetime] NULL ,
[TaskSDate2] [datetime] NULL ,
[TaskSDate3] [datetime] NULL
) ON [PRIMARY]
GO

Cheers,








[quoted text, click to view]
Re: Replicate less than 255 columns on a table with more than 300 Hilary Cotter
8/23/2006 9:11:24 AM
Try this

create database gladguy
go
create database gladguysub
go

sp_replicationdboption 'gladguy','publish','true'
go
use gladguy
go
CREATE TABLE [dbo].[TAB1] (
[PROJ_ID] [int] NOT NULL primary key,
[ProjectUniqueID] [int] NOT NULL ,
[TaskUniqueID] [int] NOT NULL ,
[TaskSCost1] [decimal](25, 6) NULL ,
[TaskSCost2] [decimal](25, 6) NULL ,
[TaskSCost3] [decimal](25, 6) NULL ,
[TaskSCost4] [decimal](25, 6) NULL ,
[TaskSCost5] [decimal](25, 6) NULL ,
[TaskSCost6] [decimal](25, 6) NULL ,
[TaskSCost7] [decimal](25, 6) NULL ,
[TaskSCost8] [decimal](25, 6) NULL ,
[TaskSCost9] [decimal](25, 6) NULL ,
[TaskSCost10] [decimal](25, 6) NULL ,
[TaskSCost1Indicator] [smallint] NULL ,
[TaskSCost2Indicator] [smallint] NULL ,
[TaskSCost3Indicator] [smallint] NULL ,
[TaskSCost4Indicator] [smallint] NULL ,
[TaskSCost5Indicator] [smallint] NULL ,
[TaskSCost6Indicator] [smallint] NULL ,
[TaskSCost7Indicator] [smallint] NULL ,
[TaskSCost8Indicator] [smallint] NULL ,
[TaskSCost9Indicator] [smallint] NULL ,
[TaskSCost10Indicator] [smallint] NULL ,
[TaskSDate1] [datetime] NULL ,
[TaskSDate2] [datetime] NULL ,
[TaskSDate3] [datetime] NULL
) ON [PRIMARY]
GO
insert into tab1
values(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,getdate(),getdate(),getdate())
insert into tab1
values(2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,getdate(),getdate(),getdate())
insert into tab1
values(3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,getdate(),getdate(),getdate())
insert into tab1
values(4,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,getdate(),getdate(),getdate())
insert into tab1
values(5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,getdate(),getdate(),getdate())
insert into tab1
values(6,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,getdate(),getdate(),getdate())
insert into tab1
values(7,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,getdate(),getdate(),getdate())
insert into tab1
values(8,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,getdate(),getdate(),getdate())
insert into tab1
values(9,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,getdate(),getdate(),getdate())
insert into tab1
values(10,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,getdate(),getdate(),getdate())
GO
create view tab1_view
as
select PROJ_ID, ProjectUniqueID, TaskUniqueID, TaskSCost1, TaskSCost2,
TaskSCost3, TaskSCost4, TaskSCost5, TaskSCost6, TaskSCost7, TaskSCost8,
TaskSCost9, TaskSCost10, TaskSCost1Indicator, TaskSCost2Indicator,
TaskSCost3Indicator, TaskSCost4Indicator, TaskSCost5Indicator,
TaskSCost6Indicator, TaskSCost7Indicator, TaskSCost8Indicator,
TaskSCost9Indicator, TaskSCost10Indicator from tab1
Go
sp_addpublication 'gladguy',@status='active'
go
sp_addpublication_snapshot 'gladguy'
go
sp_addarticle 'gladguy','tab1','tab1','tab1',
@type = 'logbased manualview', @ins_cmd='CALL sp_MSins_Tab1',
@upd_cmd='MCALL sp_MSupd_Tab1',@del_cmd='CALL
sp_MSdel_Tab1',@sync_object='tab1_view',
@creation_script = 'c:\creation_script.sql',@schema_option=0x00
GO

--sp_dropsubscription 'gladguy',@subscriber=@@servername,@article='all'
--sp_droppublication 'gladguy'

/*
--Creation script looks like this
CREATE TABLE [dbo].[TAB1] (
[PROJ_ID] [int] NOT NULL primary key,
[ProjectUniqueID] [int] NOT NULL ,
[TaskUniqueID] [int] NOT NULL ,
[TaskSCost1] [decimal](25, 6) NULL ,
[TaskSCost2] [decimal](25, 6) NULL ,
[TaskSCost3] [decimal](25, 6) NULL ,
[TaskSCost4] [decimal](25, 6) NULL ,
[TaskSCost5] [decimal](25, 6) NULL ,
[TaskSCost6] [decimal](25, 6) NULL ,
[TaskSCost7] [decimal](25, 6) NULL ,
[TaskSCost8] [decimal](25, 6) NULL ,
[TaskSCost9] [decimal](25, 6) NULL ,
[TaskSCost10] [decimal](25, 6) NULL ,
[TaskSCost1Indicator] [smallint] NULL ,
[TaskSCost2Indicator] [smallint] NULL ,
[TaskSCost3Indicator] [smallint] NULL ,
[TaskSCost4Indicator] [smallint] NULL ,
[TaskSCost5Indicator] [smallint] NULL ,
[TaskSCost6Indicator] [smallint] NULL ,
[TaskSCost7Indicator] [smallint] NULL ,
[TaskSCost8Indicator] [smallint] NULL ,
[TaskSCost9Indicator] [smallint] NULL ,
[TaskSCost10Indicator] [smallint] NULL )

*/
sp_addsubscription 'gladguy','all',@@servername,'gladguysub'
go
--wait a while
select * from gladguysub.dbo.tab1
GO
use gladguy
GO
insert into tab1
values(16,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,getdate(),getdate(),getdate())
GO
select * from gladguysub.dbo.tab1
GO
use distribution
sp_browsereplcmds
--paste the below scripts in gladguy1
/*
--
AddThis Social Bookmark Button