Showing posts with label delete. Show all posts
Showing posts with label delete. Show all posts

Friday, March 23, 2012

Propagate NEW Table to Anon Merge Replicas

How do I get a New Table to propagate to Anonymous Merge Subscribers, WITH
Add, Update, Delete Triggers?
I created a new Table (by running a SQL Script created on a Developer
machine) on a Remote SBS 2003 Server (SQL 2K). It Propagated to Subscribers,
OK. But it is useless, because is missing the Triggers: dbo.ins_ ... ,
dbo.upd_ ... , dbo.del_ ...
What did I miss, and Where? when I created the Prototype?
Aubrey Kelley
It sounds like merge replication has not placed all of the object it
requires on the subscriber. Are all objects owned by dbo? There were some
problems on pre SP 4 service packs with this.
How did you create the new table and add it to the merge publication? How
did you deploy it to your subscribers?
The best way to fix this is to reinitialize, generate a new snapshot and
send it to the subscribers. Any other approach may fix this particular
problem but there could be further missing objects and the merge replication
metadata may be in an inconsistent state.
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
"Aubrey" <miscuates@.online.nospam> wrote in message
news:B1E8B402-7B5B-4DD3-8389-9BBC7D99F109@.microsoft.com...
> How do I get a New Table to propagate to Anonymous Merge Subscribers, WITH
> Add, Update, Delete Triggers?
> I created a new Table (by running a SQL Script created on a Developer
> machine) on a Remote SBS 2003 Server (SQL 2K). It Propagated to
> Subscribers,
> OK. But it is useless, because is missing the Triggers: dbo.ins_ ... ,
> dbo.upd_ ... , dbo.del_ ...
> What did I miss, and Where? when I created the Prototype?
> --
> Aubrey Kelley

Friday, March 9, 2012

Programmatically deleting Indexes

How do you programmatically delete ALL indexes for all tables in SQL Server?
Is this possible? I was thinking about using SQL DMO to do this.
adv-thanks-anceYou can iterate through the Indexes collection of a table and then use the
Remove method to drop the index.
Tom
----
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinpub.com
"Deleting indexes through code" <Deleting indexes through
code@.discussions.microsoft.com> wrote in message
news:F01486EA-4B47-4995-A3F5-498F92D2342E@.microsoft.com...
> How do you programmatically delete ALL indexes for all tables in SQL
> Server?
> Is this possible? I was thinking about using SQL DMO to do this.
> adv-thanks-ance|||ALL of the indexes for the ENTIRE SQL Server (including all databases) ?
Might want to test that out prior to implementing it on a production
machine.
Check out the Remove method of the Indexes collection in SQL-DMO.
T-SQL - could try something like this for one db (not fully tested):
SELECT 'DROP INDEX [' + OBJECT_NAME(ID) + '.' + NAME + ']'
FROM SYSINDEXES
WHERE NAME NOT LIKE 'SYS%' AND NAME NOT LIKE 'DT%' AND NAME NOT LIKE '_WA%'
AND OBJECT_NAME(ID) NOT LIKE 'SYS%'
AND OBJECT_NAME(ID) NOT LIKE 'MS%' AND OBJECT_NAME(ID) NOT LIKE 'DT%'
AND INDID >= 1 AND INDID < 255
ORDER BY OBJECT_NAME(ID), NAME
Then copy/paste/run the resultset in a query window in QA. Since an index
associated with a constraint cannot be dropped outside of dropping the
constraint, you might have to remove some of the entries listed and drop the
constraint manually. But this might help get you started.
HTH
Jerry
"Deleting indexes through code" <Deleting indexes through
code@.discussions.microsoft.com> wrote in message
news:F01486EA-4B47-4995-A3F5-498F92D2342E@.microsoft.com...
> How do you programmatically delete ALL indexes for all tables in SQL
> Server?
> Is this possible? I was thinking about using SQL DMO to do this.
> adv-thanks-ance|||The thing about dropping and re-creating indexes is that it involves
interrupting access to the database tables. Perhaps what you are wanting to
do is periodically defragment indexes. DBCC INDEXDEFRAG does not interrupt
queries and is typically faster than REINDEX.
Microsoft SQL Server 2000 Index Defragmentation Best Practices
http://www.microsoft.com/technet/pr...n/ss2kidbp.mspx
"Deleting indexes through code" <Deleting indexes through
code@.discussions.microsoft.com> wrote in message
news:F01486EA-4B47-4995-A3F5-498F92D2342E@.microsoft.com...
> How do you programmatically delete ALL indexes for all tables in SQL
> Server?
> Is this possible? I was thinking about using SQL DMO to do this.
> adv-thanks-ance|||Take a look at this example:
http://milambda.blogspot.com/2005/0...in-current.html
...and tailor it to suit your needs.
ML|||If you use this be sure you increase or have ample room in the transaction
log for that database.
"ML" <ML@.discussions.microsoft.com> wrote in message
news:4F244CDB-0144-4EB9-ADAD-7F36D423CB42@.microsoft.com...
> Take a look at this example:
> [url]http://milambda.blogspot.com/2005/07/defragment-all-indexes-in-current.html[/url
]
> ...and tailor it to suit your needs.
>
> ML|||Unlike REINDEX, which rebuilds the entire index in one large transaction,
INDEXDEFRAG only re-aranges the physical position of specific index pages as
needed, and each unit of work is in a seperate transaction, so it would
typically use less transaction logging.
[url]http://www.microsoft.com/technet/prodtechnol/sql/2000/maintain/ss2kidbp.mspx#EFAA[
/url]
"Jerry Spivey" <jspivey@.vestas-awt.com> wrote in message
news:%23YMV3N6wFHA.2540@.TK2MSFTNGP09.phx.gbl...
> If you use this be sure you increase or have ample room in the transaction
> log for that database.
> "ML" <ML@.discussions.microsoft.com> wrote in message
> news:4F244CDB-0144-4EB9-ADAD-7F36D423CB42@.microsoft.com...
>