How To Configure Replication Triggers To SET NOCOUNT ON?
Jul 16, 2007
Hopefully simple question:
How to configure replication so that replication triggers issue a SET NOCOUNT ON?
Also: are there any negative consequences of adding a SET NOCOUNT ON to replication triggers?
I'm not a DBA so my experience with replication is pretty much non-existent. Hopefully, there's a simple configuration option that I can apply when setting up replication for a database. If not, is it going to be feasible for me to write a script that runs over the replication triggers/procs to add this SET statement (any pointers on inbuilt procs that would help here would be real useful)?
I have a software that is running with SQL Server 2005. The software has an utility to configure replication between 2 databases. When I was trying to configure it, for some reason the tool convert my main user database under system databases.
I need to put it back again under user databases.
Im thinking to backup my database first and put it offline and the restore the database again. But Im not to expert in SQL and also I am not sure if this will work putting back the database as a user database.
We are planning to setup HA using either AAG or FC. ON my production environment (P), I have transnational replication configured for 2 of databases out of three. These data get replicated to another server( C1) hosted on cloud, with local distributor at P.
If I configure AAG/ FCI , how do I handle failover?I wanted to setup P as primary AAG with two replicas as S1 and S2. P->S1 will be synchronous while P->S2 will be asynchronous.Incase my P goes down how the replication will failover S1? Incase P and S1 goes down how do I failover to S2 with the replication.
I am trying to configure replication using a script. I created the distribution database as well as the publisher. Now, I am running the stored procedure in one of the subscribers to create subscription. However, I keep getting the same error over and over again. The error reads:
msg 50000, Level 16, State 1, Procedure usp_create_AccountSubscriber, Line 43 Failed to execute SP usp_Create_AccountSubscriber: This database is not enabled for publication
Hello everyone,I am involved in a scenario where there is a huge (SQL Server 2005)production database containing tables that are updated multiple timesper second. End-user reports need to be generated against the data inthis database, and so the powers-that-be came to the conclusion that areporting database is necessary in order to offload report processingfrom production; of course, this means that data will have to bereplicated to the reporting database. However, we do not need all ofthe data in the production database, and perhaps a filtering criteriacan be established where only certain rows are replicated over to thereporting database as they're inserted (and possibly updated/deleted).The current though process is that the programmers designing thequeries/reports will know exactly what data they need from productionand be able to modify the replication criteria as needed. For example,programmer A might write a report where the data he needs can beexpressed in a simple replication criteria for table T where column X= "WOOD" and column Y = "MAHOGANY". Programmer B might come along amonth later and write a report whose relies on the same table T wherecolumn X = "METAL" and column Z in (12, 24, 36). Programmer B willhave to modify Programmer A's replication criteria in such a way as toaccomodate both reports, in this case something like "Copy rows fromtable T where (col X = "WOOD" and col Y = "MAHOGANY") or (col X ="METAL" and col Z in (12, 24, 36))". The example I gave is reallytrivial of course but is sufficient to give you an idea of what thecurrent thought-process is.I assume that this is a requirement that many of you may haveencountered in the past and I am wondering what solutions you wereable to come up with. Personally, I believe that the above method isprone to error (in this case the use of triggers to specifyreplication criteria) and I'd much rather use replication services tocopy tables in their entirety. However, this does not seem to be anoption in my case due to the sheer size of certain tables. Is thereanything out there that performs replication based on complexprogrammer defined criteria? Are triggers a viable alternative? Anyalternative out-of-the-box solutions?Any feedback would be appreciated.Regards!Anthony
I wanted to schedule the transaction replication. How do I do it? Currently I have set up a transaction replication which runs continuously and synchronizes the changes with immediate effect.
I need to configure a replication which will gather logs from the publication once in a day.
Is there a way to not initiate triggers during replication? We have a few triggers that we do not want to use while replicating. They cause data in other tables to be deleted.
I have set up some transactional replication on one of my database but I can't see where I can specify that we should replicate the triggers. What I have seen is that the triggers are automatically replicated when the table is replicated except id they are marked "Not for replication"
But it does not seem to work for me. Do you have any idea ?
Does anyone know how to remove 'Replication Triggers'?
I have a database created by export of data object. This process does not export any system tables to do with replication but there still seems to be something in the database which references them. There is no poblem if I backup and restore the dataabse.
All of a sudden none of our merge replications are working. In fact you can't even insert, update or delete and data from the tables in the merge publication. When trying that, we get an error stating:
Msg 550, Level 16, State 1, Procedure MSmerge_ins_E3F43EF8B259476099BBB194A2E1708C, Line 42 The attempted insert or update failed because the target view either specifies WITH CHECK OPTION or spans a view that specifies WITH CHECK OPTION and one or more rows resulting from the operation did not qualify under the CHECK OPTION constraint. The statement has been terminated.
Currently, the only solution I've found is to delete the publication and recreate it. I'm trying to figure out why this happened. It happened on a development server that to my knowledge, hasn't been changed in a week or so outside of changing the server's IP address. Would that cause such an error to occur?
i have setup default transactional replication using locat distributor scheme. I need to create triggers on tables at subscriber side. Can this be done using transaction replication?
If I understood correctly from some reading SET NOCOUNT ON is use so that my sp does not return the number of row affected and this should improve greatly the performance of my sp. I should use if for all insert, delete adn update sp. Is this correct? Is there any situation I need to have it set to OFF? What about if I only do a SELECT * FROM Table, is there any point to turn this ON? Thanks.
Hi, i have the next problem... I work with: - Sqlserver 2000 - Web server, Tomcat. - JDBC. - Java Aplication.
I notice that when I call a store procedure from the aplication java, I usually set no count on in my sp because of some exception errors in my aplication. But I have one special version of a jdbc that it doesnt work with this parameter. I wish it could be a parameter of the database that is set by the jdbc, but i´m not sure.
Is it possible to configure transnational replication between two different domains also non trusted domains.
It's possible means what i need to take care before configure replication and how to configure transnational replication between two different domains.
i useset nocount on inside the stored procedure at the beginning however theNumber of Rows Counted/Affected shows up when I execute the storedprocedure in query analyzer using execute sprocName. I also tried toadd theSET NOCOUNT ON at the beginning of the procedure and it still shows thenumber of rows affected.if i setset nocount onexec sprocName then the result set does not show the number of rowsaffected.Any idea why this happens? I know that NOCOUNT is set on runtime notparse time.Thanks!
I donot know how to use SQL NOCOUNT . I have written store procs for select and insert , Below are the store procs ,Can anyone tell me how to use SQL NOCOUNT in this StoreProcs??? Select: if exists (select * from dbo.sysobjects where id = object_id('[dbo].[GetAllLinks]') )drop Procedure [dbo].[GetAllLinks] GO CREATE Procedure [dbo].[GetAllLinks] AS Select * from UsefulLink Go
Insert Storeproc: if exists (select * from dbo.sysobjects where id = object_id('[dbo].[InsertLink]') )drop Procedure [dbo].[InsertLink] GOCREATE Procedure [dbo].[InsertLink] @Title varchar(100), @Location Varchar(100),@ID int OUTPUT AS Set @ID = -1Begin Transaction Insert Into UsefulLink(Title, Location) Values (@Title,@Location)if @@error <> 0 RollBack Transaction Else BEGIN Commit Transaction Select @ID = @@identity
What I am Trying To Achieve I am trying to get the ID of the row I am inserting - using code that works fine on: SQL Server 2000 with an ODBC connection and SQL Server 2005 with an ODBC connection
Problem When the code is executed it inserts the row 4 times.
My Settings I have the following OLE DB connection string:- Provider=SQLOLEDB.1;User ID=myuserid;Initial Catalog=dbname;Data Source=dbserveraddress;User Id=myuserid;PASSWORD=mypassword;
and I am executing the following SQL:- session("sessionID") = dbExecuteRS("SET NOCOUNT ON;INSERT INTO myTable (ipAddress) VALUES('"& request.serverVariables("REMOTE_HOST") &"');SELECT SCOPE_IDENTITY();SET NOCOUNT OFF;")(0)
dbExecuteRS = a function that executes a query
I know my asp page is only executing this sql once but the SQL Profiler says it is running multiple times.
What I've Tried So Far 1) A normal insert works fine - only inserts one row 2) The same SQL with an OLE DB connection string on SQL Server 2000 encounters the same problem - the insert sql with the set nocount on inserts 4 rows 3) I've tried using this bit of SQL/ASP which causes the same problem:- set tmpRS = dbExecuteRS("SET NOCOUNT ON;INSERT INTO mytable (ipAddress) VALUES('"& request.serverVariables("REMOTE_HOST") &"');SELECT newID = SCOPE_IDENTITY();") if not tmpRS.eof then response.write("tmpRS('newID'): " & tmpRS("newID") & "<BR>") end if set tmpRS = nothing
Conclusion From all of my tests I can conclude that this problem ONLY happens when we are connecting to the database via the OLE DB connection string and using an INSERT statement with SET NOCOUNT ON
I have a SP that has a cursor, and loops. Each loop executes SQL, and inserts values into a temp table on each loop. I want to just have the values in the temp table to show up in QA not the loop's sql results.
I thought:
SET NOCOUNT ON at the begining of my proc would suppress the results, and then
SET NOCOUNT OFF prior to my select on my temp table would do this, but the resultset of the loop still shows up in QA. It does suppress the count values on the message tab of QA, but that is it.
This isn€™t an problem as such, it€™s more of a debate.
If a table needs a number of update triggers which do differing tasks, should these triggers be separated out or encapsulated into one all encompassing trigger. Speaking in terms of performance, it doesn€™t make much of an improvement doing either depending upon the tasks performed. I was wondering in terms of maintenance and best practice etc. My view is that if the triggers do totally differing tasks they should be a trigger each on their own.
Guys , I have a dedicated server ... I've installed SQL SERVER 2005 and I have a problem to connect to SQL from local machines in the office ... Remote connections are on , server BRowser starts automatically ... for example from remote machinne I mean from Server where SQL is installed I can connect to SQL ... FireWall i've turned off.... What can be the problem ????
Hi, I got a website and everything works fine with SQL Server 2000, but now I modified the way of authentication using Forms and when I enter in a protected area I got this error: An error has occurred while establishing a connection to the server.When connecting to SQL Server 2005, this failure may be caused by thefact that under the default settings SQL Server does not allow remoteconnections. (provider: Named Pipes Provider, error: 40 - Could notopen a connection to SQL Server) The problem is that I don´t have SQL Server 2005 installed so I don´t know why my webapp is trying to contact it, where I can configure this settings so it will look for the Server that exists? Thanks.
In my DAL, I have 3 tables - Footballer (FootballerID = Primary Key) Aspnet Membership Table (UserID=Primary Key) Favourite Footballers (Junction Table with 2 Primary Keys FootballerID and UserID - both with foreign relationships to their respective data table)
On my sports site, visitors can view various footballers and store their favourites in th FavouriteFootballers Table by clicking on a button. This stores the Logged in UserID and FootballerID in the junction table. I now need to write a select query that allows users to click a link and view their favourites which they stored - lets say in a data list on another aspx page. This would include other columns from the Footballer Table such as Name, Age, Profile ect I think I am right in that I need to use a Select clause as I am using SQl data adapters in the DAL. Be very pleased if someone knows how to contruct the query and give me an example how to code a method in the BLL Some code is below
Method that Stores FootballerID and UserIDprotected void DataList1_ItemCommand(object source, DataListCommandEventArgs e) {
// Assuming only have one button in the item templateInt32 fid = Int32.Parse(e.CommandArgument.ToString());Guid userid = (Guid)Membership.GetUser().ProviderUserKey;
// Connect to the db and insert the recordusing (SqlConnection con = new SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\MyDatabase.mdf;Integrated Security=True;User Instance=True")) {
string query = string.Format("INSERT INTO FavouriteFootballer(UserID, ArtistID) VALUES('{0}',{1})", userid, fid); SqlCommand cmd = new SqlCommand(query, con); con.Open(); cmd.ExecuteNonQuery(); con.Close(); }
Code in FavouriteFootballersBLL Its not complete -withotu parameter - i think maybe I also need to reference the Footballer Table and not the Junction one [System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Select, true)]public DataSet1.FavouriteFootballerDataTable GetFootballerFavourites() { return Adapter.GetFootballerFavourites(); }
Hi, I am really having a hard time creating a parameter for the RadioButtonList radSearchField. I want to type 's' in the text the choose the column for the query to execute the Select statement. I was able to create a parameter for the txtSearchText but can't get the radSearchField working. My form contains four objects.
Textbox to perform the query. (name: txtSearchText)
We've A2k db which we plan to migrate to SQL 7.0 very soon. Though am familiar with upsizing wizard BUT don't know how to configure Access forms, reports etc. to talk to SQL back end tables. So that information entered via Access forms can be stored in sql and reports can be generated using sql tables..