I have an Access XP ADE application connected to a SQL Server 7.0 SP4
database. I have created a timestamp column in the main table.
Unfortunately, I am now getting persistent write conflict errors.
The order of operations are:
1. The application starts and loads the recordset into the form using a
stored procedure.
2. I modify a field and press a save button which uses me.dirty=false to
force a save.
3. The field is saved to the database. Using profiler I can observe the
modified field being saved. As I would expect, the update statement is
using the primary key and the timestamp column value. For the sake of this
discussion let's assume the value of the timestamp is 5ad9.
4. Without navigating off the record, I alter the same field (or a
different field) and press save again and a write conflict will appear.
Using profiler I can see the update statement that is attempting to update
the record. The update statement is using the previous value (5ad9) of the
timestamp column.
I thought that the timestamp column value is incremented each time the
record is updated. The ADE application does not appear to be recognizing
the new timestamp value.
Any help or advice you could give would be appreciated.
I have a database on SQL Server 2005 and am using Access 2003 for my front-end. Today, I started having problems with ONE of the tables. I can't make changes - I get the "another user has made changes" and do not have the Save Changes option - only the Copy to Clipboard or Drop Changes options. I can make changes directly to the table using the Management Studio. I don't know if it's relative, but it happened as I was trying to add an "After Update" event to set a field equal to currentuser(). Do you have any idea what may be happening? Thanks
I have read the forums and fail to be encouraged about using the timestamp to handle concurrency. I have SQL 2005 and am using the DataReader and command objects for data manipulation. The database has about a dozen related tables to each other in some way. Correct me if I am wrong, but using timestamps means I must store each table's original rowversion at read time in several possible combinations of variables (based on the joined tables at the time of read). Is this right? Then at update time, what if some related tables are timestamped with the original value and others have changed since read time? How would each update stored procedure know which other dependent tables were fetched at read time? It's easy to corrupt the data this way. SELECT s.OrderNumber, a.UserName AS OrderedBy, cn.LastName + ', ' + cn.FirstName AS ContactName, s.CarbonCopy, s.Application, s.OrderDate, s.FollowUpDate, s.ProdStartDate, s.InternalNote, s.SampleNote, s.UpdatedBy, s.DateLastUpdated, cn.EMail AS ContactEmail, s.MfgID, co.CompanyName, s.ShipVia, cn2.LastName + ', ' + cn2.FirstName AS ContactName2, co2.CompanyName AS Expr1, cn3.LastName + ', ' + cn3.FirstName AS ContactName3, s.MfgContactID, s.DistributorID, s.DistContactID, s.CustomerContactID, s.VersionStamp, a.VersionStamp, cn.VersionStamp, co.VersionStamp, cn3.VersionStamp <------- Is all this really necessary? FROM Samples AS s LEFT OUTER JOIN Associates AS a ON s.OrderedByID = a.AssociateID LEFT OUTER JOIN Contacts AS cn ON s.CustomerContactID = cn.ContactID INNER JOIN Companies AS co ON s.MfgID = co.CompanyID LEFT OUTER JOIN Contacts AS cn3 ON s.DistContactID = cn3.ContactID LEFT OUTER JOIN Contacts AS cn2 ON s.MfgContactID = cn2.ContactID LEFT OUTER JOIN Companies AS co2 ON s.DistributorID = co2.CompanyID WHERE (s.SampleID = @SampleID) What would be a simple way to update a table that depends on other tables having original version stamps? Then at runtime how would I enforce it without generating violations when the users were updating, say, the Samples table and just viewing the dependent tables' columns, not changing them.
When i try to load tables from DB2 OS390 Via DTS and DB2 ODBC it give me an error with the timestamp field. Its (DTS) says the timestamp field on SQL is marked read only.
I think I am missing some essential idea when working with a timestamp column, maybe someone around here can give me the needed pointers on how-to...
My situation is: I want to copy data periodically from one DB to another. Both are in the same SQL instance, so there are no transaction, networking or similar issues involved. It all really comes down to identifing the new rows in source and moving them over to destination.
I added a TIMESTAMP column to my source, and I can see it count up slowly for every line inserted. On the destination side, I added a table containig just one field, type binary(8) to store the last value to which the last transfer ran. Notice that on source side I got the counter on every row, but on destination side I got only one value, I thought it would be waste to carry over the data for every row when I really only need the latest one.
Now, what my package does is: a) Select the last used binary(8) value into a package variable named TS of type object (works) b) Start a dataflow, where the source is SELECT statement and the WHERE clause is TIMESTAMP > package variable TS (works) c) Multicast the data into two recordsets d) One recordset makes most of the columns flow through some Lookups, Derive Columns into a Destination and are written back. (works) e) The other exit of the Multicast shall go through all lines and catch the highest TIMESTAMP that came by using an Aggregate and write it down, since that is the point I need to pick up later. (and that is the problem)
Problems are: I cannot run Aggregate max on the TIMESTAMP. Only Count is allowed. So I need to convert the BINARY(8) into a number to be able to catch the max value. Converting between BINARY(8) and DT_I8 or similar seems not possible, or the result is wrong due to the byte ordering (MSB/LSB, most/less significant byte first)
Later on, I need to write out my new found highest value again, but here the same problem applies. How do I convert from DT_I8 back to BINARY(8)?
Having my own reference value stored as bigint instead of binary(8) does not work either: You cannot assign bigint from a select to a package variable, bigint are loaded as string (as I read in a blog, and I think they are right since I get exactly the same errors).
So... HOW does one work in an efficient way with a TIMESTAMP column to Aggregate it to max and store out this max value? Or do you all keep the TIMESTAMP from source appended to your rows and stored with each row in destination (Wasting eight precious bytes a row)?
I'm trying to filter out timestamps that land exactly at .000 milliseconds. (e.g. 2007-12-05 16:30:50.000) Do I have to convert the timestamp to a string first and then use the LIKE statement? If so, can somebody show me how. I'm pretty green to SQL but know the basics. Any help would be greatly appreciated!
Facundo writes "Hi: How can i add a timestamp to a generated file of a complete database backup, the idea is to archive full database backups using the date to identified it.
How do you add a specific timestamp to a backup? For example, if the backups are going to the same drive location on disk and you want to retain 3 days worth of backups online, how do you add the timestamp to the filename to make each backup unique?
F:MSSQL.1MSSQLBackup and your user database is <xyz>_<timestamp>.bak The user database dumps each night at 9 PM.
I have some source tables which contain timestamp fields (that's timestamp data type not datetime). My dimension table holds the maximum timestamp value as a varbinary(8).
I want my package to have a variable that holds that value but I don't know which data type to use for this. The reason for this is because I want to use that variable to then retrieve all records from my source table that have a timestamp value greater than the value stored in the variable.
I have two tables that are getting conflicts between the subscriber and the publisher, however I am pretty sure we only update these tables at the subscriber.
I have column level tracking turned on.
The tables both have Nonoverlapping, single subscription (3) set for partition options. I wonder does this do any maintenance to the tables?
I have put in place some triggers to audit what makes changes to the data, but won't know until tomorrow, so if there is something that anyone knows about that might help, please let me know.
Can someone who has had direct experience with this tell me exactly what happens when a conflict (updating same record on two nodes at the same time) occurs in a P2P replication topology? Does the Dist. Agent throw an error? More importantly does the replication set continue to replicate the articles after any error occurs?
Can someone answer/point me to an article to handle update conflicts when replicating?
Say for example, you pull down data into your sql everywhere database and start making changes. Before you replicate, changes are made in the master database that conlift with changes you've made. For example, when you pull down your data there was a product with 4 units left. So maybe you place an order for that product for 4 units while offline. However, while you were offline someone else has taken all 4 of those units and when you replicate, you need to throw an error. How do you handle this situation?
Hi, I need to set an alert when a replication-conflict occurs rather that to check for conflicts manually. How can i accomplish this? I couldn't find the particular error-message to trap in an alert.
I have set up merge replication between 1 publisher and 9 subscribers (all push subscriptions). Distributor and publisher are located on the same machine.
Although everything seems to work fine from the outside (most of the time), there are a lot of conflicts in the conflict table for the replication. They appear all the time. There are a lot of "download insert failed" conflicts. They always look like in the following three screenshots: http://www.tronk.be/conflicts/conflict1.JPG http://www.tronk.be/conflicts/conflict2.JPG http://www.tronk.be/conflicts/conflict3.JPG
In the same way, there are also many "upload insert failed" conflicts.
In addition to this, there are some "update conflict"s (but a lot less than the other conflicts). Some of them show the same row at both sides: http://www.tronk.be/conflicts/conflict4.JPG Others show a different row at the both sides: http://www.tronk.be/conflicts/conflict5.JPG
The only thing that causes a real problem is the last screenshot, although I don't understand why the other conflicts are there (the inserst statements actually seem to happen anyway, even though there are conflicts). In case of the last screenshot, I can't find any place where an UPDATE actually happens at APP-STB, while I can clearly pinpoint the UPDATE at the other side (which is what actually comes from our program).
One more thing, the system is running on its limits, but all replication seems to be working fine.
I've been experiencing conflicts in my replication system that I can't seem to get my head around. The following is the scenario:
3 sqlservers, all running sql server 2005. Server B is the publisher and Server A and Server C (64 bit) are subscribers. The Queue Reader Agent runs on the publisher. I set up transactional repl with updateable subscriptions with the default conflict resolution policy of 'Publisher wins'.
There are 2 kinds of processes: 1. Nightly batch updates and 2. Daytime updates by real clients. The Nightly batch updates runs an on the publisher, which is B. Batch updates are massive updates and running it on the publisher makes sense and it works like a charm. Online updates are made on the subscriber 'C'. This subscriber is set to Queued update mode, and everyday I see a significant number of transactions that are detected as conflicts and the Publisher wins. As a result the changes made on Server C are getting lost. I have verified that no user/client is logged into Server B to do any updates. Users complain that their updates are lost. This is the most puzzling and frustrating bit. I don't see how a conflict can happen if nobody is updating data on the Publisher during the day. SQL Updates on Server C are getting rolled back on a conflict detection because the "Publisher wins", and SQL Inserts on server C are getting deleted because they don't exist on the publisher. Now, how can a insert done on the subscriber be marked as a conflict. There is no row on the publisher to compare the unique guid with, how can it be a conflict?
And the Queue Reader Agent crashes every 3-4 days. No useful information except it creates a dump file for which users have no tools to read it.
Has anyone seen this behavior ? Or is there a known bug in the QueueReader Agent?
My users are losing faith in the replication system and so am I.
I am using SQL Server 2000 Merge Replication. Sometimes when the data is replicated there are conflicts which when examined show it is due to voliation of foreign key constraint. But the data (keys) in already present in the master tables. Is there a way to give an order to the way the tables are replicated. This is so because i think the data in the details table is relpicated first instead of the master table. The conflicts are resolved properly when done using the conflict viewer.
Hi everyone, I'm creating a ASP.NET 2.0 web application utilizing sql server 2000 as a database. My problem revolves around multiuser acces with long running processes. Some of the pages in the application have long running processes against large tables in the database, lets say that take 2minutes to complete. My problem is how do I utilize ado properly in the rest of my application to display a message to users who may try to access data associated with a table while in the midst of one of its long running processes? For instance I would like to notify the user that "Table X is currently locked, please try again in a few minutes".Do I catch sqlException and examine the .Number property? Any insight is appreciated. Thanks.
I have heard that there are potential problems if you put service pack for NT on your server, in that it conflicts with SQL 6.5. Does anyone know of any such problems with either running 6.5 under these conditions or installing 6.5 if the service pack is already on the server. Thanks
I have maintenance plan on DBABC backup log to .trn job to run every 90 minutes (daily).
in order to keep the log file small, I also set up a job (T-SQL) to run at 4:15 am to backup log ABC with truncate_only, then run dbcc shrinkdatabase (DBABC, 10)
it looks "backup log ABC with truncate_only" has conflicts with the every90 minutes backup transaction log.
Question: could I keep the backup transaction log every90 minutes, but still could shrink the log file. The log file is growing very fast.
Or I have to use differential backup instead of backup tran log?
Hello all... I'm stuck, I cannot figure out how I should go about flaggingconflicts on a sheduling app. I currently have 8 columns (school grades)that have class over the course of 9 periods. I am populating the asp pagefine, and making changes to the database with forms lists. I need to compareall the results of one period (thats 8 results) so that i may find aclassroom conflict. Is there any solution in SQL?This is my query:sql = "SELECT * FROM schedule WHERE period ='"&num&"'"I step through this 9 times in a for/next loopThanks in advance!Alpay Eno
I am busy extending a VB6 app to talk to SQL Server Express 2005 and have come across a naming conflict. Some of the columns in the application's Access 97 tables is "index" which obviously exists as a T-SQL keyword and therefore any queries I perform including this column throws a syntax error. I tried prefixing the columns with their table names as in TableName.Index, but this still throws up the syntax error which I thought was a bit odd. I preferably want a fix that will be Access as well as T-SQL compliant but if that's not possible I will just write a string converter that does the job based on anyone's suggestions. TIA
i have both server instances installed on same machine, 1st is sql 2k enterprise and 2nd is sqlExpress 2005.
all was working fine till today, i renamed a catalog in the express2005 instance. the reason for this renaming was a duplicate catalog name in the 2k and in the 2005 so when i backup my dbs one is overwriting the other because of the same file name.
after this rename i started to get some errors in the application so i decided to rename it back to its original name and relocate the backup destination to other folder.
now the situation in that i cant login any more to the 2005 server, when i login to servsqlexpress2005 (via manager or via odbc) i see always the 2k server. i tried to login to any server name like .sqlexpress2005 or whatever i always get to see the 2k catalogs only.
in proccess list i see both sqlserv.exe proccesses, also in services all is working fine, i only cant access to this server in any way.
PLEASE HELP!!! should i reinstall 2005 instance? i dont wanna do that i have so much configs on it include very massive reporting services
***the more that i try to connect my 2k5 server the problem looks wierd more and more. when i connected as localhostsqlexpress2005 i succeeded... but in 2-3 minutes connection didnt turn off, but it switched to the 2k server... it looks like a major bug!!! how can connection switch himself between 2 server without even notice??
exec ('CREATE SYNONYM tblsynonym FOR ' + @cx + '..TableName')
---Procedure
drop synonym tblsynonym
The application i'm working on uses stored procedures that will at some point be called by more than one user at a time. At the start of the stored procedure the synonym is created and then it is dropped when the procedure completes, the issue is this: if two users access the same stored procedure at the same time then the first procedure will create the synonym and the second will fail because the syonym already exists.
There's really strange issue. I have the table 'Resellers' with 'ResellerID' as identity column. As a rule, the records are inserted into this table at publisher. Usually, the subscribers just update this table.
After I added several new columns to the table, the strange conflicts had appeared at the subscriber side:
The merge process is retrying a failed operation made to article 'Resellers' - Reason: 'Violation of PRIMARY KEY constraint 'PK_Resellers'. Cannot insert duplicate key in object 'dbo.Resellers'.'.
If I look into MSmerge_conflict_Core_Resellers conflicts table at the subscriber, I see that 'ResellerID' column contains value '1'. Of course, the record with such 'ResellerID' already exists. But at the publisher the record with the given rowguid has quite other value!
Why?! What is the reason of such behaviour?
I did re-init of the subscriber - no result, rather, all records which had conflicts appeared in the table, but the recent created records has conflicts again.
- Transactional (5 articles - tables only) Users receive data based on their territory #, therefore they receive their customers sets of data. It happens that customer change from one territory to another but not frequently. When it happens, so far so good, the data is redirected to the new salesrep using the model we configured (Territory table with SUSER_NAME() to filter the data).
Ok, here's my problem. Since a while, I can see in the replication monitor that some users seems to log the same conflict again and again (Merge process). I mean, checking the history for many subscribers, there is always the same number in the "Conflict" colums. As an example: - Merge completed after processing 18 data change(s) (4 insert(s), 14 update(s), 0 delete(s), 31 conflict(s)) - Merge completed after processing 27 data change(s) (10 insert(s), 17 update(s), 0 delete(s), 31 conflict(s)) - Merge completed after processing 20 data change(s) (5 insert(s), 15 update(s), 0 delete(s), 31 conflict(s))
and so on...(Those are only 3 historical entries for a single subscriptions but there are many like that, always with the same count of conflict - vary per user). It appears to me that the same conflicts come over and over.
The thing is that if I decide to reinitialize a subscription, conflicts will disappear, therefore I know that it is not a process on the server that keeps changing the data; anyway, even if it was, changes would be applied on the subscription because the server always win in my setup.
Any idea what should I do with this? Any help would be greatly appreciated. Thanks.
I got a problem with merge replication. I got a central sql server 2005 database on which i got a publication. Also there are 2 sql servers CE which are subscribers to that publication. I need to add some records on both mobile servers indepently but i'm using primary key as a user id in one table. So when i add a user on one PDA i use next available number in column ID. In the same time I add a user on other PDA with the same ID, because I don't know that there is such user with the same ID. Ok then I do synchronization. First PDA synchronizes with server but second tells me that there is a record with the same PK. And my question is. Can these be resolved writing a custom resolver or maybe you know others resolutions, because I think that is a typicall problem but couldn't find any solution other than using ie. HOST_NAME() function.
I was hoping a sharp eye may be able to pick up on what I am doing wrong here, I am i must be making a comon mistake. If necessary I am happy to create and post a sample if necessary.
Problem: The publication parent table has a filter (defined below) and also has a join filter(defined below) to a child table. When changes are made to the parent and child table and synchronised a conflict is raised. For the child table for some reason the merge agent is saying an explicit update occured at the publisher but the values at the publisher have not changed at all and no sql has been executed to update the publisher rows. This in effect is stopping the changes to the child table being applied until i manually apply them in the conflict resolver. The strange thing is the conflict should not occur in the first place.
Perhaps my SQL server 2005 version? 9.00.2050.00 SP1 Standard Edition
Environment:
SQL Server 2005 - 9.00.2050.00 SP1 Standard Edition SQL Server Mobile Detail:
FKs are
FK: Job.JobScheduleID --> JobSchedule.ID
FK: JobDetail.JobID --> Job.ID
All three tables have int based IDs that are auto increment.
Publication Articles:
JobSchedule is download only
Job is Bidirectional, identity range management is MANUAL (only updates occur on this table)
JobDetail is Bidirectional, identity range management is MANUAL (only updates occur on this table)
Filters are of the following form:
Filter Job:
SELECT <published_columns> FROM [dbo].[Job] WHERE convert(nchar,[companyID])=Host_Name() AND [JobCompletedDate] IS NULL AND
( [JobScheduleID] in (SELECT distinct ID from JobSchedule where GETDATE() BETWEEN [JobSchedule].[start] AND [JobSchedule].[end]) )
Join Filter Job --> JobDetail
SELECT <published_columns> FROM [dbo].[Job] INNER JOIN [dbo].[JobDetail] ON [Job].[ID] = [JobDetail].[JobID] Now the first thing to note with respect to using GetDate() i have read http://msdn2.microsoft.com/en-us/library/ms365153.aspx so i thought that i would remove that portion of the Filter on the Job table just to see what happens.
SELECT <published_columns> FROM [dbo].[Job] WHERE convert(nchar,[companyID])=Host_Name() AND [JobCompletedDate] IS NULL
This still did not resolve the issue. I then Remove the AND [JobCompletedDate] IS NULL and it then started working fine (cool) but of course no longer satisfys the rule i want to create (seriously uncool ).
Sadly the hostnames for the boxes I am trying to replicate are similar:
- db1.nyc.mydomain.tld - db1.sac.mydomain.tld
The servers can talk to each other over all necessary ports however when I generate a push subscription from the publisher, I am asked to add the SQL Server subscriber and it already shows DB1 listed since itself is DB1.nyc. How can I attach the remote subscriber when setting up the subscription from the publisher if the hostname conflicts in my unique scenario?I created a entry on the publishers host file to use db2sac for the SAC IP and entering that alias in as the remote subscriber but no dice.
I think I will have a problem with Id’s when I do merge replication. The problem is, I have several clients (local shops) who can do additions to a (Customer) table. Other tables will link to that table (things that a customer buys) with their foreign key, so the id of this table is very important. Now, twice a day that table with customers is merged from all clients to the central server. (the table with things that the customer buys, does not needs to be merged as it only remains local).
Possible problem: if we assign ranges to identifiers for each client (thus local shop), which will be the best option we found until so far, how can we then detect the doubles? (with doubles, we mean that when the same customer is added in two local shops for a first time, then we will have the same customer twice in the central database)(afterwards, when we delete one customer row in the central database, we might have a id conflict when we merge back to the clients -as a customer might have already bought some goods at the two different shops meanwhile-)
What’s the common practice to resolve this? (we need to do Merge Replication, because during the day, our local shops are disconnected from the central server)