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

sql server replication

group:

Checking for replication when applying schema changes



Checking for replication when applying schema changes Ron L
3/28/2006 12:00:00 AM
sql server replication: All

Is there some simple way to check if a database is being replicated that I
can use in a script? I have 2 copies of a production database, one under
replication and one not, and I would like to have any schema change scripts
check for replication to see which action to take. E.g.

<script>
If <database is replicating>
sp_addreplcolumn ...
Else
Alter Table...

</script>

TIA
Ron Lounsbury

Re: Checking for replication when applying schema changes Hilary Cotter
3/28/2006 9:22:04 AM
sp_dboption 'pubs','published'
GO
sp_dboption 'pubs','merge publish'
GO


--
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: Checking for replication when applying schema changes Ron L
3/28/2006 2:26:59 PM
Hilary

Thanks for the reply. Unfortunately, when I run that against a database
that is participating in replication and one that is not, both give me a
result for the "CurrentSetting" of OFF. This occurs for both "Merge
Publish" and "Publish". Is there something I am missing? I am running SQL
Server 2000, SP 3a (with some hotfixes).

Thanks,
Ron Lounsbury


[quoted text, click to view]

Re: Checking for replication when applying schema changes Hilary Cotter
3/28/2006 2:45:21 PM
If it returns off it means these databases are not enabled for replication.

--
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: Checking for replication when applying schema changes Ron L
3/28/2006 2:56:13 PM
Hilary

When I run this script in Query Analyzer:
USE NITSS2kDev
exec sp_dboption 'pubs','merge publish'
GO
use NITSS2kdeployed
exec sp_dboption 'pubs','merge publish'
GO

I get these results:
OptionName CurrentSetting
----------------------------------- --------------
merge publish off

OptionName CurrentSetting
----------------------------------- --------------
merge publish off

NITSS2kDev is actively replicating with 2 other databases, and one of the
replication jobs ran 3 minutes ago. NITSS2kDeployed is not replicating.
The script was run on the Publishing server.

Thanks,
Ron L

[quoted text, click to view]

Re: Checking for replication when applying schema changes Ron L
3/29/2006 12:00:00 AM
Oh Man, My Stupid. I don't know where my brain was yesterday. When I put
the right database name in the call it works fine.

Thanks,
Ron L

[quoted text, click to view]

AddThis Social Bookmark Button