Creating a table in MS ACCESS 2007 without a primary key - ms-access

Can I do this?
The reason I want to do this is, I am importing data from a csv file to access, and during the import process it creates a lot of problems with the autonumber in access.
The tables are not going to be linked in anyway

A primary key is not mandatory. If you don't want one, don't add one!

Yes, but consider adding it back when you're done importing. Otherwise you may run into issues when trying to do edits, deletes, etc. If you want to be able to edit or delete the records after you've imported, then you'll want a primary key. If you just need read-only access to the data after import, then you should be fine without a primary key.

Related

Is there a way in Microsoft Access to import from an Excel File with a composite primary key?

I have an excel file that comes from an export from an online platform. I want to import it into Microsoft Access. Most of the sheets contain data that are unique according to a composite key. However, when I am importing a sheet with the assistant, it is possible to let Access add a primary key, select one field as a primary key or to declare no primary key. There is no option to directly declare a composite key.
I tried to declare no primary key and to open the Create mode to declare the composite key myself. It does work, but when I rerun my saved import, the composite key is lost.
How can I import a sheet with a composite key or at least not lose my composite key when running the saved import? Is this even possible?
I found an answer on another topic that should suit my needs.
Access - Update Imported Data
The idea is to import in temporary tables, where the primary key can be an auto-increment. "Then, run an update inner join query against your final Access table".
It seems that there is no way of importing without overwriting the declared primary keys, but do tell me if you know a way of doing it, I'm still interested.
I'm not validating the answer yet as I didn't test it, but I will come back here when it will be the case.

still error "multiple primary keys defined" when tables/databases are dropped

I want to put my live site (wordpress) on localhost, so I exported the database (turning on the options for dropping database and tables) with phpmyadmin. When importing on localhost with BigDump I get the error message that "Multiple primary keys are defined".
How can I solve this?
All the suggestions I have read so far say to drop the tables and/or database when exporting from live site. I did that but it makes no difference. What else can I do to succesfully import the DB on localhost?
Check your create table statements in exported file. May be somewhere in your create statemate two primary keys are defined.
A table can have only one primary key, which may consist of single or multiple fields. When multiple fields are used as a primary key, they are called a composite key.
If possible cereate database and tables manually and remove table creation statements from expoted file and you can source only data from the file.

Microsoft Access linked table (ASE) with trigger error

I have in Microsoft Access a linked table to an ASE Server.
On the server side, the table has no primary key or identity columns.
And has a trigger on insert that validates new entries, so that when the entry is not validated it deletes the entry from the table and writes to "table"_ERR to let the users know what error was produced.
When linking it to Access a composite key is created using 10 columns.
I have this same setup in 10 different tables (all with triggers all linked to Access)
In this particular table when trying to insert/append records to the table through Access i always get the error message:
Single-row update/delete affected more than one row of a linked table. Unique index contains duplicate values.
This error occurs when both table and table_ERR are empty and i'm only trying to insert 1 record.
If I disable the trigger i have no problem inserting records through Access
I have similar triggers in other tables that are working correctly.
What can be causing this issue and does anyone know how to solve this?
I have read that MS Access can mess up the ##identity, even so none of the solutions presented online seem to work.
links : https://groups.google.com/forum/#!msg/microsoft.public.sqlserver.programming/McHdRpPKMhs/SlyObU8w7JMJ
Stop Access from using wrong identity when appending to linked table on SQL server
Thanks in advance.
EDIT: if i try to insert the records directly from a management software (like Aqua Data Studio) there are no erros
Without knowing more specifics about your data itself, it is difficult to say why this might be happening.
However, it sounds like in this specific instance for this specific linked table, your 10 columns are not unique enough to prevent non-distinct rows from being selected.
Suggested fixes:
Add a primary key. Honestly, probably the best and easiest choice.
If for some reason you cannot add a new column to (or alter) your table; you may be able to re-link your table, and re-choose your 10 columns so that they are more unique.
Beyond that, I think we would need more information.
Just out of curiousity, what is the reason for having no key?

access 2010 with linked sql tables

I have a split form view with data coming from linked sql server (2008).
How do I go about updating the record?
Currently, it will not let me change anything in the text boxes i assume this is because the data is coming from linked tables?!
In order to update do i have to create command and coonn objects and program it in the usual vb manner?
And if so, what is the syntax for referencing the linked tables when creating the update query?
On my split form I dropped a button on there and I can see options to make it run macro, run code, etc etc, which one is suitable?
many thanks,
KS
First make sure the table was not linked read-only.
When you link to a remote table, Access will make it read-only if it is unable to identify a primary key or another combination of fields to uniquely identify each row. Sometimes, but not always, it may ask you to tell it which field(s) to use as the primary key if it is uncertain.
But this issue is simple to check. Open the linked table directly in Datasheet View and see whether you can edit any values. If not, re-link the table and look for an option to inform Access about the primary key.
If the link is not read-only, make sure your form's Allow Edits property is set as Yes.
Also you could try a simple form rather than a split form to determine whether something about the split form is causing the problem.
Solution:
MS Access barfs when trying to register tables with a primary key of type BigInt which is 8 bytes, Access can only handle Ints of 4 bytes. Workaround is below:
Drop the constraint (bigint PK) in SQL table
Create a new primary key (int) with identity seed
Link the table in MS Access
Drop new constraint (int PK) & Re-Add your previous constraint (bigint PK) in MS SQL
Voila!

InvalidOperationException Occur when trying to run the insert query of Linq to sql

InvalidOperationException:
Can't perform Create, Update, or Delete operations on 'Table(PollOptionVote)' because it has no primary key
But Table(PollOptionVote) contains a primary key
Please advice
It has happened to me a couple of times that the DBML file is out of sync with the DB.
First, doublecheck that it really has a primary key.
Afer that, open your dbml file, remove the table, add it again.