How To Addd/remove Entire Table In Replication Shema ?
Aug 19, 2002
Hi everybody,
We are using SQl-2000 Sp2 clustured on two compaq servers
We have to modify our database shema every month.
We are using sp_repladdcolum and sp_repldropcolum to
modify table without snapshot.
Owever I would like to add/delete entire table in shema
database without using snapshot ?
Hi,I have started an aspnetdb and it is now in use. It appears as though I "can" change the table structure, by this I mean I simply want to add a field, but can I get some feedback of the issues that this casue?Thanks,CES
Problem: I have a user who wants to remove table, but when she tries to remove it ( drop the table), she gets an error: =========================================================== MSG 3724, Level 16, State 2, Line 6: Cannot drop the table, 'dbo.<table name>' because it is being used for replication. MSG 2714, Level 16, State 6, Line 2 There is already an object named '<table name>' in the database. ============================================================
To investigate, I saw the following:
In the SSMS---> Replcation---> Local Publication--> [XYZ].Pub_XYZ [SERVER Name].[XYZ_Replication]
Local Subscriptions: [Reference DB].[ServerInstance].[Instance Name]:ABC.ABC_TO_XYZ.Reference DB).
How do I remove that table? Do I need to edit Replication? How? Which one?
Hi! I've some data in a table, and I want to add these records to another table, but I tried yet with select ... Into ... and I lose all the data from this one. I need to ADD the data from table to table. Any suggestion? Thx
Hi,I need to lock a table so that Inserts are prevented as well as deleted andupdates. At present I'm thinking this might do it:SELECT * FROM myTable WITH(UPLOCK)but then again I'm not sure whether this will cover the insert case.Thanks,Robin
How can I do in order that a table show all its rows in a page?And if the table can only show a number of rows cause arrive to the end of the page show the table in the next page?
I am giving the following statement outside the begin tran block in a stored procedure: select * from table1 with (holdlock) where column1 = @colValue I have the following two questions regarding above situation:
Being outside the begin tran block, will the select statement cause a lock to be held or it has to be within the begin tran block for the lock to be held? Will the select statement hold a lock only on the row or rows matching the where clause, or it may lock a page or even the entire table in this situation? Thanks
I'm a newbie to script writing. I'm trying to write a script to copy alldata from a table to the same table in a 2nd database. Both databases areon the same server and are identical in design. I can do this with DTS butwanted a script I could email to a user to run in Query Analyzer.Example:Copy entire table called 'Customers' in the 'Data01' database totable 'Customers' in the 'Data02' databaseI want to overwrite all data in the destination table.Thanks
The problem that I am having is that I am not getting the results from an entire table, just a small subset. The sql command is "Select * from login", which has always implied to me, get everything, to end of table, or, until I tell you to stop. I am getting exactly, 10 items as input, and then it stops. I am including the code below in the hopes that someone can spot what it is that I am doing wrong.
The purpose of the routine is to convert a user login database into a new, expanded format.
TIA, Tom
Imports Common.Utility.Utils
Partial Class UserDatabaseConversion
Inherits System.Web.UI.Page
Dim sqlConn As SqlConnection = getSQLConnection(ConfigurationManager.AppSettings("utilityDbName"))
Dim sqlConnN As SqlConnection = getSQLConnection(ConfigurationManager.AppSettings("utilityDbName"))
Dim sqlStringOld As String = "Select * from login"
Dim sqlStringNew As String = "usp_UT_AddNewUser"
Dim buildCnt As Integer = 0
Dim oldUserCnt As Integer = 0
Dim newUserCnt As Integer = 0
Dim oLocation As String = Nothing
Dim errors As Integer = 0
Dim mesg As String = Nothing
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Hi, all. I have two server(Svr01, Svr02) that are replicated each other (Merge replication). Svr01 must be Publisher distributor.. but, by mistake Svr02 is set to distributor, publisher. (Publisher/distributor are on the same comp..)
I want to fix this.. How?
I think I have to remove replication on both side and Reset from the first. but, I don't know how to remove replication either..
I had a HDD failure that caused the database to become SUSPECT. Thats ok we have backups to fall back on. Restoring the database failed because the database is used for repliacation, the database status was set to LOADING (in middle of restore). Because of this status I am unable to remove the repliaction to allow the database restore.
Whats a way to change the database status from loading? Or is there any way of removing it completely and starting again from a backup? Can I force repliaction to be removed?
Thanks for taking the time to look at my problem, all help and suggestions are much appreciated.
I try to remove a replication with from my MS SQL 2000
DECLARE @publication AS sysname DECLARE @publicationDB AS sysname SET @publication = N'MyDB_merge' SET @publicationDB = N'MyDB' -- Remove the merge publication. USE [MyDB] EXEC sp_dropmergepublication @publication = @publication; -- Remove replication objects from the database. USE master EXEC sp_replicationdboption @dbname = @publicationDB, @optname = N'merge publish', @value = N'false' GO
but seems to do nothing, how many time cost this operation? MSSQL search something ?
There is a solution for remove rapidly a replication from my database.
Hello, I have a table that I want to cache. So, if this is my query "SELECT * FROM myTable" that I create the cache from, how can I filter the data? I really need to cache the whole table, since there are a myriad of different statements being executed against the table, so just caching a specific query won't do. I've found the best approach to make a question is writing it in code, so how can I do the following: SELECT ColNames FROM MyTableWhichShouldNowBeCached WHERE whereColumns=someParams. ColNames and someParams make up for a variation of about to 120 different queries. I use SQL 2005 express edition with advanced services. Cheers! /Eskil
This SQL statement, though carefully written to delete only selected rows, deletes the entire A_Shift_Times table:
DELETE FROM A_Shift_Times WHERE EXISTS ( SELECT 1 FROM Users WHERE (A_Shift_Times.time_in >= CONVERT(DATETIME, '2000-05-29 00:00:00', 102)) AND ((Users.User_Password LIKE N'mrr%') OR (Users.User_Password LIKE N'work%')))
I'm trying to create a query that searches an entire database for keywords inside of the columns for each table within the database. For instance my tables have 2 columns one named ID and the other Permission, I'd like it be able to return all the lines that are associated with that keyword. So if I search "Schedule" it returns all the lines containing that word in it within that database.
I usually go for the largest datafile and then query in-there...But now I need to automate it for several instances... I need to be able with one script quickly retrieve the top 5 largest tables for the entire instance,not by database...
Hi I have a problem. I have a replicated database. Now I have a couple of tables within the database where I delete the content row by row and caluted the new record and insert them. Now when I do this on the development system that is unreplicate it is fine. However on production that is replicated I get this error:
System.Web.HttpUnhandledException: Exception of type System.Web.HttpUnhandledException was thrown. ---> System.Data.SqlClient.SqlException: INSERT statement conflicted with COLUMN FOREIGN KEY constraint 'FK_VARLISTS_USERVARLISTS'. The conflict occurred in database 'BHP', table 'USERVARLISTS', column 'AutoID'. INSERT statement conflicted with COLUMN FOREIGN KEY constraint 'FK_VARLISTS_USERVARLISTS'. The conflict occurred in database 'BHP', table 'USERVARLISTS', column 'AutoID'. INSERT statement conflicted with COLUMN FOREIGN KEY constraint 'FK_VARLISTS_USERVARLISTS'. The conflict occurred in database 'BHP', table 'USERVARLISTS', column 'AutoID'.
Now I persume this is caused by the foreign key being contrained by the replicated database. I had though about unticking the box 'Enforce Relationship for replication' but I am not sure what problems this may cause.
Woudl this fix my problem? If not do you have any idea what would.
One of our users tried to set replication solution in a sqlserver (the idea was given up). SQL Server added in each table a column related to replication. We want to remove theses columns and I used the following script :
select 'ALTER TABLE dbo.'+object_name(id)+' DROP CONSTRAINT '+object_name(constid)+' GO' +'ALTER TABLE dbo.'+object_name(id)+' DROP COLUMN '+'msrepl_tran_version GO' from sysconstraints where object_name(constid) like '%msrep%'
Question: 1. I want to know how to introduce a carraige return in order to have some thing like this :
... ALTER TABLE dbo.T_CommandCopyFile DROP CONSTRAINT DF__T_Command__msrep__44AB0736 GO ALTER TABLE dbo.T_CommandCopyFile DROP COLUMN msrepl_tran_version ... 2. Is there any other solution to do this more simply ?
Windows 2012 R2, SQL 2012 (Primary Replica) SQL 2012 (Seondary Replica) SQL 2012 (Secondary Replica over WAN site)
There are database replicating on three SQL servers. WAN line is having performance issue because of limited bandwidth I have to remove SQL secondary replica over WAN site temporarily and add it again later when the WAN line is upgraded with between bandwidth What is the best practice to remove secondary replica and replicating database and add later from SQL management studio without interruptions on databases?
After I setup the merge replication in SQL SERVER 7.0, there is a rowguid column (datatype uniqueidentifier) inserted into each table in the both the source and destination database.
I need to get rid of the rowguid column in all tables. I deleted the replication, but the column still existed.
Is there an easy way to get rid of all the rowguid column in the database? Thanks for your reponse in advanced.
Hi all, I'm a rather newbie, not only to this forum but also to sql server having a question to the following issue: Is it possible to drop/remove/delete the "orphan" of a merge subscription on one instance of sql server without having the (former) distributor/publisher (on other instance) available? The background is: I had a small replication infrastructure with two instances (on two machines), one the publisher and distributor, the other the subscriber. Now it happened that the publisher/distributor machine was completely set up new without having the replication dropped in advance, what remained on the subscriber is now a database with all the merge/replication tables and the guid columns in the user tables. Moreover this, an entry remained in the subscription saying that a subscription with the former publisher exists...
Can I remove these "orphans" without having to setup the instance again?
I have found some articles with no publication in our transactional replication.
For example, running this:
select p.publication, a.publication_id, a.article from dbo.MSArticles as a left outer join dbo.MSpublications as p on a.publication_id = p.publication_id
shows this:
NULL1org_Community NULL3org_Community Purchasing to EDW5org_Community NULL1org_Division NULL3org_Division Purchasing to EDW5org_Division
How can I get rid of the articles that are not part of a publication?
I can't use sp_droparticle because it requires a publication which these articles do not have.
I need a SSIS Package that compares the two tables and removes the rows in the first table with keys that do not exist in the second table. For example....
I have a table of returns based on returnID. In another table I have returnErrors that are based on returnID as well. I want a package that will uses my returns table as a source and compares that dataset to the dataset of the returnError and remove or spilt the data so that my remaining dataset only has returns that have returnErrors. I can do this in T-SQL, but I am looking for a SSIS solution that uses the conditional split transformation or some other transformation(s) combinations.
I have small table that has been corrupted. I'm getting the following error when running a simple select statement: "could not open FCB for invalid file ID 0 in database 'data_base_name'. Table or database may be corrupt. connection broken."
I have already created a new table, but I have been unsuccessful at removing the corrupted table. Does anyone know the steps to go about removing this table? And, if anyone has seen this type of error before, why did it occur? Is it a bug with microsoft SQL7? Any info would be greatly appreciated. Thanks in advance