Hi, we are using SQL2005 merge replication, and have 2 publications that
reference the same article. We are trying to change the tracking level option
for this article, but it is greyed out and disabled, because it knows the
article is in another publication, and it disallows this change. We recreated
this on another server. The option, along with the resolver tab options, get
completely greyed when the 2nd publication is added. Any ideas how to change
the tracking level in this case? Should we use a stored procedure to set this
option? Thanks.
Some publication options are limited by other publications the article is
in. There is no way to change this without dropping all publications and
making these properties consistent in all publications.
Another example of one of these properties is automatic identity range
management.
Hilary Cotter
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
"nkleinjan" <nkleinjan@.discussions.microsoft.com> wrote in message
news:325082EB-74C2-42E9-AFB7-843D23CB53B4@.microsoft.com...
> Hi, we are using SQL2005 merge replication, and have 2 publications that
> reference the same article. We are trying to change the tracking level
> option
> for this article, but it is greyed out and disabled, because it knows the
> article is in another publication, and it disallows this change. We
> recreated
> this on another server. The option, along with the resolver tab options,
> get
> completely greyed when the 2nd publication is added. Any ideas how to
> change
> the tracking level in this case? Should we use a stored procedure to set
> this
> option? Thanks.
Showing posts with label replication. Show all posts
Showing posts with label replication. Show all posts
Friday, March 30, 2012
Wednesday, March 21, 2012
Reseeding Identity column on subscriber
Hi,
Is it possiible to re-seed the identity column on a subscriber which is
using merge replication.
I am getting PK constraints when inserting a row.
Thanks
have a look at
sp_MSadjustmergeidentity
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
"mm" <postto@.news.com> wrote in message
news:uy7V4AFwEHA.3620@.TK2MSFTNGP09.phx.gbl...
> Hi,
> Is it possiible to re-seed the identity column on a subscriber which is
> using merge replication.
> I am getting PK constraints when inserting a row.
> Thanks
>
Is it possiible to re-seed the identity column on a subscriber which is
using merge replication.
I am getting PK constraints when inserting a row.
Thanks
have a look at
sp_MSadjustmergeidentity
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
"mm" <postto@.news.com> wrote in message
news:uy7V4AFwEHA.3620@.TK2MSFTNGP09.phx.gbl...
> Hi,
> Is it possiible to re-seed the identity column on a subscriber which is
> using merge replication.
> I am getting PK constraints when inserting a row.
> Thanks
>
Friday, March 9, 2012
Republishing a subscribed database
In a merge replication application with 100 subcribers the merge process is
generating large numbers of locks on the published db and causing
performance problems.
One suggestion was that we subscribe all external (VPN on ADSL) merge
subscribers to a subscribed copy of the database created explicitly for this
purpose, thereby reducing load on the primary db. Any comments? or has
anyone implemented a similar scheme and found it beneficial?
This is a good approach. You should try to identify where the locking is
coming from. For instance if you try to modify/manage your publications
using EM this can cause a large amount of locking. So use the procs if
possible.
Also use pull if you can. Then stagger your agents to run non-continuously
at different times.
"Tony Toker" <xyzzy@.identic.co.uk> wrote in message
news:cqbln8$dp4$1$8302bc10@.news.demon.co.uk...
> In a merge replication application with 100 subcribers the merge process
is
> generating large numbers of locks on the published db and causing
> performance problems.
> One suggestion was that we subscribe all external (VPN on ADSL) merge
> subscribers to a subscribed copy of the database created explicitly for
this
> purpose, thereby reducing load on the primary db. Any comments? or has
> anyone implemented a similar scheme and found it beneficial?
>
>
generating large numbers of locks on the published db and causing
performance problems.
One suggestion was that we subscribe all external (VPN on ADSL) merge
subscribers to a subscribed copy of the database created explicitly for this
purpose, thereby reducing load on the primary db. Any comments? or has
anyone implemented a similar scheme and found it beneficial?
This is a good approach. You should try to identify where the locking is
coming from. For instance if you try to modify/manage your publications
using EM this can cause a large amount of locking. So use the procs if
possible.
Also use pull if you can. Then stagger your agents to run non-continuously
at different times.
"Tony Toker" <xyzzy@.identic.co.uk> wrote in message
news:cqbln8$dp4$1$8302bc10@.news.demon.co.uk...
> In a merge replication application with 100 subcribers the merge process
is
> generating large numbers of locks on the published db and causing
> performance problems.
> One suggestion was that we subscribe all external (VPN on ADSL) merge
> subscribers to a subscribed copy of the database created explicitly for
this
> purpose, thereby reducing load on the primary db. Any comments? or has
> anyone implemented a similar scheme and found it beneficial?
>
>
Labels:
application,
database,
isgenerating,
locks,
merge,
microsoft,
mysql,
numbers,
oracle,
process,
published,
replication,
republishing,
server,
sql,
subcribers,
subscribed
Republisher replication model
Hi, how can be implemented republisher replication model?
When I first configure and create a publication "P1", and then create pull
subscripton on "RP1 = Publishing subscriber" everything is ok. But whenever I
try to create a new Publication on RP1 I get an error message which says that
before creating publication the subscription shoulfd be dropped, then create
pub and at last create pull subscription again. Unfortunetly this approach
does not work.
Vice versa when I first create publication P1, then another publication RP1
for the subscriber and finally create a pull subscription on RP1 having P1 as
Publisher, EM says that again first drop publication and then create pull
subscription...
So, how can I implement republisher replication model?
The answer is :
In order to use this topology the publishing subscriber must be a global
subscriber for publisher P1.
"Erkan Aygun" wrote:
> Hi, how can be implemented republisher replication model?
> When I first configure and create a publication "P1", and then create pull
> subscripton on "RP1 = Publishing subscriber" everything is ok. But whenever I
> try to create a new Publication on RP1 I get an error message which says that
> before creating publication the subscription shoulfd be dropped, then create
> pub and at last create pull subscription again. Unfortunetly this approach
> does not work.
> Vice versa when I first create publication P1, then another publication RP1
> for the subscriber and finally create a pull subscription on RP1 having P1 as
> Publisher, EM says that again first drop publication and then create pull
> subscription...
> So, how can I implement republisher replication model?
When I first configure and create a publication "P1", and then create pull
subscripton on "RP1 = Publishing subscriber" everything is ok. But whenever I
try to create a new Publication on RP1 I get an error message which says that
before creating publication the subscription shoulfd be dropped, then create
pub and at last create pull subscription again. Unfortunetly this approach
does not work.
Vice versa when I first create publication P1, then another publication RP1
for the subscriber and finally create a pull subscription on RP1 having P1 as
Publisher, EM says that again first drop publication and then create pull
subscription...
So, how can I implement republisher replication model?
The answer is :
In order to use this topology the publishing subscriber must be a global
subscriber for publisher P1.
"Erkan Aygun" wrote:
> Hi, how can be implemented republisher replication model?
> When I first configure and create a publication "P1", and then create pull
> subscripton on "RP1 = Publishing subscriber" everything is ok. But whenever I
> try to create a new Publication on RP1 I get an error message which says that
> before creating publication the subscription shoulfd be dropped, then create
> pub and at last create pull subscription again. Unfortunetly this approach
> does not work.
> Vice versa when I first create publication P1, then another publication RP1
> for the subscriber and finally create a pull subscription on RP1 having P1 as
> Publisher, EM says that again first drop publication and then create pull
> subscription...
> So, how can I implement republisher replication model?
Labels:
configure,
create,
database,
implemented,
microsoft,
model,
modelwhen,
mysql,
oracle,
publication,
pullsubscripton,
replication,
republisher,
server,
sql
Wednesday, March 7, 2012
Republisher (publishing subscriber) merge replication
Hi,
I am trying to have a republisher run with Merge replication, but am getting error messages anytime I try to publish to the third tier.
Any suggestions on where I can find more info?
Thanks
Wil
I ran into touble once trying that until I set the subscriber type
(sp_AddMergeSubscription) to Global. You might want to check your setting.
Paul
"Wil" <wil@.canoemail.com> wrote in message
news:258CA56C-2CE7-4531-8998-704C698E6DA3@.microsoft.com...
> Hi,
> I am trying to have a republisher run with Merge replication, but am
getting error messages anytime I try to publish to the third tier.
> Any suggestions on where I can find more info?
> Thanks
> Wil
|||what is your error message?
"Wil" <wil@.canoemail.com> wrote in message
news:258CA56C-2CE7-4531-8998-704C698E6DA3@.microsoft.com...
> Hi,
> I am trying to have a republisher run with Merge replication, but am
getting error messages anytime I try to publish to the third tier.
> Any suggestions on where I can find more info?
> Thanks
> Wil
I am trying to have a republisher run with Merge replication, but am getting error messages anytime I try to publish to the third tier.
Any suggestions on where I can find more info?
Thanks
Wil
I ran into touble once trying that until I set the subscriber type
(sp_AddMergeSubscription) to Global. You might want to check your setting.
Paul
"Wil" <wil@.canoemail.com> wrote in message
news:258CA56C-2CE7-4531-8998-704C698E6DA3@.microsoft.com...
> Hi,
> I am trying to have a republisher run with Merge replication, but am
getting error messages anytime I try to publish to the third tier.
> Any suggestions on where I can find more info?
> Thanks
> Wil
|||what is your error message?
"Wil" <wil@.canoemail.com> wrote in message
news:258CA56C-2CE7-4531-8998-704C698E6DA3@.microsoft.com...
> Hi,
> I am trying to have a republisher run with Merge replication, but am
getting error messages anytime I try to publish to the third tier.
> Any suggestions on where I can find more info?
> Thanks
> Wil
Labels:
database,
error,
merge,
messages,
microsoft,
mysql,
oracle,
publish,
publishing,
replication,
republisher,
run,
server,
sql,
subscriber,
third,
tier
Saturday, February 25, 2012
Repost: Merge Replication Error - Failed to enumerate changes in the filtered article
Hi,
I am using Merge Replication and the subscriber is a pull subscriber.
Some tables are filtered, in the publication properties, if I go to FILTER
ROWS, then FILTER CLAUSE column, some tables are filtered like so
depot_system_id = 'xxxxx-xxxxx-xxxxx-xxxxxx' where x makes up the guid.
The replication objects are owned by DBO.
Versions of SQL:
Publisher:
Microsoft SQL Server 2000 - 8.00.760 (Intel X86)
Dec 17 2002 14:22:05 Copyright (c) 1988-2003 Microsoft Corporation
Standard Edition on Windows NT 5.2 (Build 3790: )
Subscriber:
MSDE
Everything was working fine, then all of a sudden, I get this error. (See
below)
Does anyone know what would cause this and how I can overcome it?
Thanks in Advance
Warren
************************************************** *
******************ERROR DETAILS******************
************************************************** *
Last command: {call sp_MSsetupbelongs(?,?,?,?,?,1,?,?,1,?,?,?,?,?,?)}
Error Message: Failed to enumerate changes in the filtered articles.
Error Details:
Failed to enumerate changes in the filtered articles.
(Source: Merge Replication Provider (Agent); Error number: -2147200925)
Incorrect syntax near the keyword 'where'.
(Source: GENCENTRIC_SVR1 (Data source); Error number: 156)
Incorrect syntax near the keyword 'and'.
(Source: GENCENTRIC_SVR1 (Data source); Error number: 156)
************************************************** *
*******************END OF ERROR******************
************************************************** *
Someone reported a similar problem and solved it by reapplying sp3a.
http://groups-beta.google.com/group/... e3a5eb8c1ea7a
Hilary Cotter
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
"Warren Patterson" <des@.newsgroups.nospam> wrote in message
news:eYSANebNFHA.2468@.tk2msftngp13.phx.gbl...
> Hi,
> I am using Merge Replication and the subscriber is a pull subscriber.
> Some tables are filtered, in the publication properties, if I go to FILTER
> ROWS, then FILTER CLAUSE column, some tables are filtered like so
> depot_system_id = 'xxxxx-xxxxx-xxxxx-xxxxxx' where x makes up the guid.
> The replication objects are owned by DBO.
> Versions of SQL:
> Publisher:
> --
> Microsoft SQL Server 2000 - 8.00.760 (Intel X86)
> Dec 17 2002 14:22:05 Copyright (c) 1988-2003 Microsoft Corporation
> Standard Edition on Windows NT 5.2 (Build 3790: )
> Subscriber:
> --
> MSDE
>
> Everything was working fine, then all of a sudden, I get this error. (See
> below)
> Does anyone know what would cause this and how I can overcome it?
> Thanks in Advance
> Warren
> ************************************************** *
> ******************ERROR DETAILS******************
> ************************************************** *
> Last command: {call sp_MSsetupbelongs(?,?,?,?,?,1,?,?,1,?,?,?,?,?,?)}
> Error Message: Failed to enumerate changes in the filtered articles.
> Error Details:
> Failed to enumerate changes in the filtered articles.
> (Source: Merge Replication Provider (Agent); Error number: -2147200925)
> ----
--
> --
> Incorrect syntax near the keyword 'where'.
> (Source: GENCENTRIC_SVR1 (Data source); Error number: 156)
> ----
--
> --
> Incorrect syntax near the keyword 'and'.
> (Source: GENCENTRIC_SVR1 (Data source); Error number: 156)
> ----
--
> --
> ************************************************** *
> *******************END OF ERROR******************
> ************************************************** *
>
>
|||Hi Hilary,
Installing SP3a doesnt make sense to me. I have 4 other publications on
that same machine, setup the exact same way, except the filters are on other
ID {"depot_system_id = 'xxxxx-xxxxx-xxxxx-xxxxxx' where x makes up the
guid."} and they are working perfectly.
I am running service pack 3 only. I cant remember, but something in the
deep recesses of my mind is telling me that there was a reason I didnt
install SP3a onto the publisher, but I cant remember why.
"Hilary Cotter" <hilary.cotter@.gmail.com> wrote in message
news:eYPCVpeNFHA.508@.TK2MSFTNGP12.phx.gbl...
> Someone reported a similar problem and solved it by reapplying sp3a.
>
http://groups-beta.google.com/group/... e3a5eb8c1ea7a[vbcol=seagreen]
> --
> Hilary Cotter
> 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
> "Warren Patterson" <des@.newsgroups.nospam> wrote in message
> news:eYSANebNFHA.2468@.tk2msftngp13.phx.gbl...
FILTER[vbcol=seagreen]
(See
> ----
> --
> ----
> --
> ----
> --
>
I am using Merge Replication and the subscriber is a pull subscriber.
Some tables are filtered, in the publication properties, if I go to FILTER
ROWS, then FILTER CLAUSE column, some tables are filtered like so
depot_system_id = 'xxxxx-xxxxx-xxxxx-xxxxxx' where x makes up the guid.
The replication objects are owned by DBO.
Versions of SQL:
Publisher:
Microsoft SQL Server 2000 - 8.00.760 (Intel X86)
Dec 17 2002 14:22:05 Copyright (c) 1988-2003 Microsoft Corporation
Standard Edition on Windows NT 5.2 (Build 3790: )
Subscriber:
MSDE
Everything was working fine, then all of a sudden, I get this error. (See
below)
Does anyone know what would cause this and how I can overcome it?
Thanks in Advance
Warren
************************************************** *
******************ERROR DETAILS******************
************************************************** *
Last command: {call sp_MSsetupbelongs(?,?,?,?,?,1,?,?,1,?,?,?,?,?,?)}
Error Message: Failed to enumerate changes in the filtered articles.
Error Details:
Failed to enumerate changes in the filtered articles.
(Source: Merge Replication Provider (Agent); Error number: -2147200925)
Incorrect syntax near the keyword 'where'.
(Source: GENCENTRIC_SVR1 (Data source); Error number: 156)
Incorrect syntax near the keyword 'and'.
(Source: GENCENTRIC_SVR1 (Data source); Error number: 156)
************************************************** *
*******************END OF ERROR******************
************************************************** *
Someone reported a similar problem and solved it by reapplying sp3a.
http://groups-beta.google.com/group/... e3a5eb8c1ea7a
Hilary Cotter
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
"Warren Patterson" <des@.newsgroups.nospam> wrote in message
news:eYSANebNFHA.2468@.tk2msftngp13.phx.gbl...
> Hi,
> I am using Merge Replication and the subscriber is a pull subscriber.
> Some tables are filtered, in the publication properties, if I go to FILTER
> ROWS, then FILTER CLAUSE column, some tables are filtered like so
> depot_system_id = 'xxxxx-xxxxx-xxxxx-xxxxxx' where x makes up the guid.
> The replication objects are owned by DBO.
> Versions of SQL:
> Publisher:
> --
> Microsoft SQL Server 2000 - 8.00.760 (Intel X86)
> Dec 17 2002 14:22:05 Copyright (c) 1988-2003 Microsoft Corporation
> Standard Edition on Windows NT 5.2 (Build 3790: )
> Subscriber:
> --
> MSDE
>
> Everything was working fine, then all of a sudden, I get this error. (See
> below)
> Does anyone know what would cause this and how I can overcome it?
> Thanks in Advance
> Warren
> ************************************************** *
> ******************ERROR DETAILS******************
> ************************************************** *
> Last command: {call sp_MSsetupbelongs(?,?,?,?,?,1,?,?,1,?,?,?,?,?,?)}
> Error Message: Failed to enumerate changes in the filtered articles.
> Error Details:
> Failed to enumerate changes in the filtered articles.
> (Source: Merge Replication Provider (Agent); Error number: -2147200925)
> ----
--
> --
> Incorrect syntax near the keyword 'where'.
> (Source: GENCENTRIC_SVR1 (Data source); Error number: 156)
> ----
--
> --
> Incorrect syntax near the keyword 'and'.
> (Source: GENCENTRIC_SVR1 (Data source); Error number: 156)
> ----
--
> --
> ************************************************** *
> *******************END OF ERROR******************
> ************************************************** *
>
>
|||Hi Hilary,
Installing SP3a doesnt make sense to me. I have 4 other publications on
that same machine, setup the exact same way, except the filters are on other
ID {"depot_system_id = 'xxxxx-xxxxx-xxxxx-xxxxxx' where x makes up the
guid."} and they are working perfectly.
I am running service pack 3 only. I cant remember, but something in the
deep recesses of my mind is telling me that there was a reason I didnt
install SP3a onto the publisher, but I cant remember why.
"Hilary Cotter" <hilary.cotter@.gmail.com> wrote in message
news:eYPCVpeNFHA.508@.TK2MSFTNGP12.phx.gbl...
> Someone reported a similar problem and solved it by reapplying sp3a.
>
http://groups-beta.google.com/group/... e3a5eb8c1ea7a[vbcol=seagreen]
> --
> Hilary Cotter
> 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
> "Warren Patterson" <des@.newsgroups.nospam> wrote in message
> news:eYSANebNFHA.2468@.tk2msftngp13.phx.gbl...
FILTER[vbcol=seagreen]
(See
> ----
> --
> ----
> --
> ----
> --
>
Labels:
article,
database,
enumerate,
error,
failed,
filtered,
merge,
microsoft,
mysql,
oracle,
properties,
publication,
pull,
replication,
repost,
server,
sql,
subscriber,
tables
REPOST: Merge Replication Conditional Filter with UDF Problem - Help !
Hi all,
I'm still stuck on this issue. Please find a re-cap below. I'd be really grateful if anyone
could shed some light on this.Thanks a million :o)
I am performing merge replication between SQL CE/Server 2000.
I would like to select the stores specific to each rep
unless the repid = 6, in which case I would like to select
all stores. Is this possible in merge replication?
I have been attempting to set the host_name() to my repID and
passing this Host_Name() into a table-valued UDF. The aim
being that the UDF will return a table of stores. My problem
is that I'm receiving an error and I would like to know if
UDF's accept Host_Name() as a parameter ?
My Dynamic Filter ...
SELECT <published_columns> FROM [dbo].[Stores] WHERE
Stores.RepID IN (SELECT * FROM SELECT_Stores_RepID(Host_Name()))
The Error I'm receiving ...
Error 170: Line 1: Incorrect Syntax near '('.
Cube,this is my previous reply:"I have only been able to use UDFs before
when they are scalar, eg SELECT <published_columns> FROM [dbo].[Region]
WHERE region.regionid = dbo.fn_TaxRate(host_name())works fine. In your case
can you restructure your query to return a scalar value and then use this
value combined with another table in a join + where clause perhaps?"You
mentioned that you would give it a try and post back your results - how did
it go?Regards,Paul Ibison
|||Hi Paul,
I gave this a go but I didn't have much joy, maybe I'm just confused as to how to
go about things. As you mentioned I changed my Dynamic Filter so that I returned
the RepID ...
SELECT <published_columns> FROM [dbo].[tbl_Usr] WHERE
CAST(FK_Rep_ID AS char(4)) = Host_Name()
Next I attempted to use this in an Extended Filter (which is where I ran into problems) ...
SELECT <published_columns> FROM [dbo].[tbl_Usr] INNER JOIN
[dbo].[Stores] ON Stores.RepID IN (SELECT * FROM
SELECT_Stores_RepID(tbl_Usr.TKT_RepID))
This product the syntax error ...
Error 170: Line 1: Incorrect Syntax near '.'.
This will work if I pass in a constant instead of tbl_Usr.TKT_RepID, which of
course I can't do. (At this stage you're probably saying to yourself...this guy just
tried the same thing he did in the Dynamic Filter...and is chasing his tail ;o)
I'm very open to trying alternative queries/approaches. At this stage I've looked at this
so many times I need some devine inspiration ;o)
Thanks in advance,
|||OK - I'll give it a try and post up an example later this afternoon (5pm UK
time).
Regards,
Paul
|||OK, have tested it and it works. Here is how I did it:
I had 2 tables: MainTable and LookupTable
MainTable
ID,Description
1,aaa
2,bbb
3,ccc
LookupTable
ID,Description,Host
1,aaa,Host1
2,bbb,Host1
3,ccc,Host999
My filter is LookupTable.Host = Host_Name()
The tables are joined on LookupTbale.ID = MainTable.ID
I set the -HOSTNAME parameter on the merge agent to be Host1 and only 2
records from each table are replicated. This successfully mimics what you
are doing with the subquery.
Any questions, please post back.
Paul Ibison
|||Hi Paul,
This is what I've been doing to date. But what I'd like is to select ALL records
if Host_Name() = some Rep ID set by the Merge Agent. Pseudocode...
IF (Host_Name() = 6)
SELECT * FROM Stores
ELSE
SELECT * FROM Stores WHERE RepID = Host_Name()
Maybe your filters do this, and I'm just missing the point ?
Thanks for the time you're giving me :o)
-- Paul Ibison wrote: --
OK, have tested it and it works. Here is how I did it:
I had 2 tables: MainTable and LookupTable
MainTable
ID,Description
1,aaa
2,bbb
3,ccc
LookupTable
ID,Description,Host
1,aaa,Host1
2,bbb,Host1
3,ccc,Host999
My filter is LookupTable.Host = Host_Name()
The tables are joined on LookupTbale.ID = MainTable.ID
I set the -HOSTNAME parameter on the merge agent to be Host1 and only 2
records from each table are replicated. This successfully mimics what you
are doing with the subquery.
Any questions, please post back.
Paul Ibison
|||Cube,
such logic is part of the linking table. If you had 3 stores, then the
linking table looks like this:
LookupTable
StoreID,Host
1,6
2,6
3,6
For the other hostnames there are records representing the corresponding
links:
LookupTable
StoreID,Host
1,6
2,6
3,6
2,999
HTH,
Paul Ibison
I'm still stuck on this issue. Please find a re-cap below. I'd be really grateful if anyone
could shed some light on this.Thanks a million :o)
I am performing merge replication between SQL CE/Server 2000.
I would like to select the stores specific to each rep
unless the repid = 6, in which case I would like to select
all stores. Is this possible in merge replication?
I have been attempting to set the host_name() to my repID and
passing this Host_Name() into a table-valued UDF. The aim
being that the UDF will return a table of stores. My problem
is that I'm receiving an error and I would like to know if
UDF's accept Host_Name() as a parameter ?
My Dynamic Filter ...
SELECT <published_columns> FROM [dbo].[Stores] WHERE
Stores.RepID IN (SELECT * FROM SELECT_Stores_RepID(Host_Name()))
The Error I'm receiving ...
Error 170: Line 1: Incorrect Syntax near '('.
Cube,this is my previous reply:"I have only been able to use UDFs before
when they are scalar, eg SELECT <published_columns> FROM [dbo].[Region]
WHERE region.regionid = dbo.fn_TaxRate(host_name())works fine. In your case
can you restructure your query to return a scalar value and then use this
value combined with another table in a join + where clause perhaps?"You
mentioned that you would give it a try and post back your results - how did
it go?Regards,Paul Ibison
|||Hi Paul,
I gave this a go but I didn't have much joy, maybe I'm just confused as to how to
go about things. As you mentioned I changed my Dynamic Filter so that I returned
the RepID ...
SELECT <published_columns> FROM [dbo].[tbl_Usr] WHERE
CAST(FK_Rep_ID AS char(4)) = Host_Name()
Next I attempted to use this in an Extended Filter (which is where I ran into problems) ...
SELECT <published_columns> FROM [dbo].[tbl_Usr] INNER JOIN
[dbo].[Stores] ON Stores.RepID IN (SELECT * FROM
SELECT_Stores_RepID(tbl_Usr.TKT_RepID))
This product the syntax error ...
Error 170: Line 1: Incorrect Syntax near '.'.
This will work if I pass in a constant instead of tbl_Usr.TKT_RepID, which of
course I can't do. (At this stage you're probably saying to yourself...this guy just
tried the same thing he did in the Dynamic Filter...and is chasing his tail ;o)
I'm very open to trying alternative queries/approaches. At this stage I've looked at this
so many times I need some devine inspiration ;o)
Thanks in advance,
|||OK - I'll give it a try and post up an example later this afternoon (5pm UK
time).
Regards,
Paul
|||OK, have tested it and it works. Here is how I did it:
I had 2 tables: MainTable and LookupTable
MainTable
ID,Description
1,aaa
2,bbb
3,ccc
LookupTable
ID,Description,Host
1,aaa,Host1
2,bbb,Host1
3,ccc,Host999
My filter is LookupTable.Host = Host_Name()
The tables are joined on LookupTbale.ID = MainTable.ID
I set the -HOSTNAME parameter on the merge agent to be Host1 and only 2
records from each table are replicated. This successfully mimics what you
are doing with the subquery.
Any questions, please post back.
Paul Ibison
|||Hi Paul,
This is what I've been doing to date. But what I'd like is to select ALL records
if Host_Name() = some Rep ID set by the Merge Agent. Pseudocode...
IF (Host_Name() = 6)
SELECT * FROM Stores
ELSE
SELECT * FROM Stores WHERE RepID = Host_Name()
Maybe your filters do this, and I'm just missing the point ?
Thanks for the time you're giving me :o)
-- Paul Ibison wrote: --
OK, have tested it and it works. Here is how I did it:
I had 2 tables: MainTable and LookupTable
MainTable
ID,Description
1,aaa
2,bbb
3,ccc
LookupTable
ID,Description,Host
1,aaa,Host1
2,bbb,Host1
3,ccc,Host999
My filter is LookupTable.Host = Host_Name()
The tables are joined on LookupTbale.ID = MainTable.ID
I set the -HOSTNAME parameter on the merge agent to be Host1 and only 2
records from each table are replicated. This successfully mimics what you
are doing with the subquery.
Any questions, please post back.
Paul Ibison
|||Cube,
such logic is part of the linking table. If you had 3 stores, then the
linking table looks like this:
LookupTable
StoreID,Host
1,6
2,6
3,6
For the other hostnames there are records representing the corresponding
links:
LookupTable
StoreID,Host
1,6
2,6
3,6
2,999
HTH,
Paul Ibison
Subscribe to:
Posts (Atom)