Access ODBC linked table to SQL Server allows inserts but not updates - sql-server

Based on Web readings, I built a new ODBC connection, carefully looking for subtle configuration parameters that might suggest fostering updates, but none were found. Then I tested the new link.
To Re-Test my issue:
1) I created the following table on SQL Server 2005:
[TestTbl]
column1: Key Type:Integer
Column2: Name Type:varchar(5)
Populated as follows
Key Name
=== ====
1 Apple
2 Bear
3 Cat
2) Then in Access 2007, created a link to the SQL Server table TestTbl using my latest ODBC connection.
3) Next successfully inserted the following new records into the SQL Server table using the link and executing my inserts from Access 2007:
Key Name
=== ====
4 Dog
5 Elephant
4) Finally I tried to execute the following simple update query:
UPDATE dbo_TestTable SET dbo_TestTable.TestName = "CatNip"
WHERE (((dbo_TestTable.TestKey)=3));
I got the error message "Operation must be an updateable query"
5) Out of frustration, I inserted another record
Key Name
=== ====
6 Nonsense
Then I posted this question asking for help.
Can anyone please explain why I can insert new records to the linked table but I cannot update existing records?

The problem you are having is because there is either no primary key defined or when you linked the table in Access the Primary key was not defined. Re-add the linked table (delete and add) and select a primary key field, in this case column1

Related

Informatica only insert last data row into database table

I am a newbie in informatica tool.
I run a workflow to insert data from database A, table A.A to database B, table B.B. Session did succeed.
And I met a problem in log file:
Database errors occurred:
Execute -- Informatica' ODBC 20101 driver27376073
Execute -- ODBC Driver Manager Function sequence error
When last step to insert data to B.B
It is only 1 row inserted per workflow running time. Example: I have 7 rows, only 1 row inserted and 6 rows rejected.
I search for 27376073 error code but I found nothing about it.
Can anyone help me solve this problem, please?
are you using aggregator transformation cheak groupby port marked or not
and if source is a FF and fixed width we need to do some settings in session task

how to remove dirty data in yugabyte ( postgresql )

I try to add a column to a table with GUI Tableplus, but no response for long time.
So I turn to the db server, but got these error:
Maybe some inconsistent data generated during the operation through the Tableplus.
I am new to postgresql , and don't know what to do next.
-----updated------
I did some operation as #Dri372 told, and got some progress.
The failed reason for table sys_role and s2 is that the tables are not empty, they have some records.
If I run sql like this create table s3 AS SELECT * FROM sys_role; alter table s3 add column project_code varchar(50);, I successed.
Now how could I still work on the table sys_role?

Error when adding values to an Access ADP form bound to a SQL stored procedure with a join

I have an Access 2003 ADP project that connects to SQL Server 2008 Express Edition.
When I try adding values to a form that has as it's RecordSource a SQL Strored Procedure that uses a JOIN, I get the following error:
You can't update the record because another user or application deleted it or changed the value of its primary key.
The code for the Stored Procedure is:
SELECT F.Description, T.Quantity, T.Points
FROM Test T
RIGHT OUTER JOIN tblCriteriaCategory1 F
ON T.FunctionalityID = F.tblCriteriaCategory1ID
(The values I'm trying to add are those for Quantity and Points to table Test)
I have also created the appropriate ForeignKey relationship on the Test and tblCriteriaCategory1 tables.
Thank you for any assistace with the above
You probably need to make FunctionalityID the primary key for Test.
This knowledge base article show almost the exact same scenario as you are experiencing

SQL Server: Copying table contents from one database to another

I want to update a static table on my local development database with current values from our server (accessed on a different network/domain via VPN). Using the Data Import/Export wizard would be my method of choice, however I typically run into one of two issues:
I get primary key violation errors and the whole thing quits. This is because it's trying to insert rows that I already have.
If I set the "delete from target" option in the wizard, I get foreign key violation errors because there are rows in other tables that are referencing the values.
What I want is the correct set of options that means the Import/Export wizard will update rows that exist and insert rows that do not (based on primary key or by asking me which columns to use as the key).
How can I make this work? This is on SQL Server 2005 and 2008 (I'm sure it used to work okay on the SQL Server 2000 DTS wizard, too).
I'm not sure you can do this in management studio. I have had some good experiences with
RedGate SQL Data Compare in synchronising databases, but you do have to pay for it.
The SQL Server Database Publishing Wizard can export a set of sql insert scripts for the table that you are interested in. Just tell it to export just data and not schema. It'll also create the necessary drop statements.
One option is to download the data to a new table, then use commands similar to the following to update the target:
update target set
col1 = d.col1,
col2 = d.col2
from downloaded d
inner join target t on d.pk = t.pk
insert into target (col1, col2, ...)
select (d.col1, d.col2, ...) from downloaded d
where d.pk not in (select pk from target)
If you disable the FK constrains during the 2nd option - and resume them after finsih - it will work.
But if you are using identity to create pk that are involves in the FK - it will cause a problem, so it works only if the pk values remains the same.

The merge process could not update the list of subscriptions

I have replication set up between a sql-server 2005 instance and multiple sql-server 2000 instances. The replication will successfully for a while before I get the following error message:
Violation of UNIQUE KEY constraint 'unique_pubsrvdb'. Cannot insert duplicate key in object 'dbo.sysmergesubscriptions'. (Source: MSSQLSERVER, Error number: 2627)
When I checked sysmergesubscriptions there were extra entries that appear to be coming from the 2000 instances.
My question is has anyone encountered this issue and how did you deal with it (without rebuilding the entire thing)
In my case handling multiple subscriptions and just had to adapt to delete subscriptions that had problems with:
delete
from sysmergesubscriptions
where pubid not in (select pubid from sysmergepublications)
and subscriber_server = 'SUBSCRIPTIONSERVER'
The problem was that one of the subscribers had old publications and subscriptions in the system tables that were replicated through out the entire system. Which caused the violation of UNIQUE KEY constraint.
Once we removed these old entires we were able to restart replication.
We were able to identify the valid records in sysmergepublication because we knew the state of this table before the invalid entries were replicated. This forum post shows you how to location invalid publications if you need to.
We used the follow sql to check for additional subscription entries:
select *
from sysmergepublications
select *
from sysmergesubscriptions
where pubid in ( select pubid from sysmergepublications)
select *
from sysmergesubscriptions
where pubid not in ( select pubid from sysmergepublications)
Here is the sql that we used to delete the invalid subscriptions:
delete from sysmergesubscriptions
where pubid not in ( select pubid from sysmergepublications)
Note: the code sample above assumes that the sysmergepublication contains only valid publications
Alternatively: You can use the EXEC sp_removedbreplication #dbname='<dbname>' to remove replication from the database completely. This command appears to remove all replication triggers from the database.

Resources