I am trying to import data from a text file to Access 2007 and 2010, delimited by vertical bar. I use Import Text Wizard of MS Access, but when I try to import it after choosing appropriate delimiter (preview looks fine), I get the following error:
The changes you requested to the table were not successful because they would create duplicate values in the index, primary key, or relationship. Change the data in the field or fields that contain duplicate data, remove the index, or redefine the index to permit duplicate entries and try again.
There are no primary keys, nor relationships, as it is just a text file. I was able to insert this text file in Windows XP, but the problem arises in Windows 7. I was able to successfully export the data into Excel. I also set Indexed to No in Field Options of Import Text Wizard, but that didn't help either.
Any help would be greatly appreciated, as I couldn't find any useful info anywhere.
Edit: I tried inserting into new and existing tables, even a new database (accdb and mdb format), every time I get the same error.
Edit2: I opened the text file in WordPad, and saved it again as txt file, the Access didn't generate any error. The previous txt file didn't show the new lines, but Access was still aware where each record ends, and preview looked fine. The new text file specifically shows new lines (each record separately). If someone has a suggestion about how to overcome this issue without creating a new txt file, please let me know
I don't think there is anything you can do except convert the file to Windows CRLF format.
Although I wouldn't use WordPad for this, but Notepad++.
It has an explicit command for this: Edit -> EOL conversion, and you can be fairly sure that it won't change anything else in your file (I wouldn't be so sure about WordPad).
Actually most text editors that are more sophisticated than Notepad have a command for this, I think. :)
Related
A table containing almost four thousand records includes a mediumblob field for each record that contains the record's associated PDF report. Under both MySQL Workbench and phpMyAdmin the relevant DOCUMENT column displays the data as a BLOB button or link. In the case of phpMyAdmin the link also indicates the size of the data the Blob contains.
The issue is that when the Blob button/link is clicked, under MySQL Workbench opening any of the files using the SQL Editor only displays the raw Blob data and under phpMyAdmin th link only allows the Blob data to be saved as a .bin file instead of displaying or saving the data as a viewable PDF file. All previous attempts to retrieve the original PDFs using PHP have failed - see related earlier thread: Extract Pdf from MySql Dump Saved as Text.
The filename field in the table shows that all the stored files are PDF files. Further research and tests indicate that the mediumblob data has been stored as application/octet-streams.
My question is how can the original PDFs be retrieved as readable PDFs? Is it possible for a .bin file saved from the database to be converted or used to recover the original PDF file?
Any assistance would be greatly appreciated.
In line with my assumption and Isaac's suggestion the only solution was to be able to speak to one of the software developers. It transpires that the documents have been zipped using an third-party library as well as the header being removed before then being stored in the database.
The third-party library used is version 2.0.50727 of Chilkat, available from www.chilkatsoft.com. That version no longer appears to be available, but hopefully at least one of the later versions may do the job.
Thanks again for everyone's input and assistance.
Based on the discussion in the comments, it sounds like you'll need to either refer to the original source code or consult with the original developer to determine exactly how the data was stored.
Using phpMyAdmin to download the mediumblob data as a file will download a .bin file in many cases, I actually don't recall how it determines content type (for instance, a PNG file will download with a .png extension, but most other binary files simply download as a .bin when phpMyAdmin isn't sure what the extension should be, PDF included). So the behavior you're seeing from phpMyAdmin is expected and correct, but since the .bin file doesn't work when it's renamed to .pdf that means something has probably gone wrong with the import and upload.
BLOB data is often stored in a pretty standardized way, but it seems your data doesn't follow that method.
Without us seeing the code directly, we can't guess what exactly happened with storing the data and would only be guessing.
I'm trying to link to a text file from the Access Link Text Wizard (as I've successfully done hundreds of times before) but this time I'm getting an error stating
Syntax error in PARAMETER clause.
No parameterized query is being used so I'm at a bit of a loss, I'm only trying to link to a text file.
In Access 2016 I go to the External Data tab and click Text File. I browse to my tab-delimited text file and select the Link to the data source creating a linked table option. As soon as I click OK it gives me the error above.
My text file is very simple with 2 columns and about 100 rows of data. This file is created from a Stored Procedure in SQL Server 2016 using BCP. If I manually create a text file with test data using the same format I don't get the error, which leads me to believe it may be some data in the file causing the error? I can't figure out how to attach text files to my question so any suggestions are welcome.
EDIT: I copied all data from the offending file into a new text file and it linked properly so it's not the data. I am often creating text files from a SQL Server Stored Procedure then linking to it from Access. This is the first time I've experienced this particular error.
EDIT2: I recreated a text file manually with the same data from the offending file and named it the same this time (Procedure Class Listing.txt) and I got the error. Is something wrong with this title???
EDIT3: Sorry for so many edits. I tried naming the file without the spaces and it links properly. I have linked to files with spaces in the name before so I don't understand.
FINAL EDIT: So it appears that a text file starting with the word "Procedure" followed by a space is giving me this error. I can remove all spaces (ProcedureClassListing.txt) and it works fine (which is the solution I'm going with).
So it appears that a file starting with the word "Procedure" followed by a space is giving me this error. I can remove all spaces (ProcedureClassListing.txt) and it works fine (which is the solution I'm going with).
I have SSIS Package which will load .EXT file into my Database table.
The package Flat File connection manager Editor properties are
Format: Ragged Right
Code Page: 1252 ANSI (Latin-I)
Text Qualifier: <None>
Header Row Delimiter: <LF>
While trying to preview the file before loading, i am able to see all the rows in columns and
preview tab of Flat File connection manager Editor.
But in actual loading of the file, last record alone is not getting imported into table.
It was loading fine and still it is processing the file on daily basis.
Only for two days file, it was not imported last records. I am trying to find the root cause.
I suspected something wrong with the file, but i do not find any differences between the
working and not-working version of files.
Please suggest us to resolve the same. Kindly let me know if any informations required.
I ran into the same issue and did some research to find a solution that worked from me. Apparently the SSIS package had gone through a conversion from an earlier version at one point. When the conversion was done, the text qualifier property on the flat file connection was mangled. It had originally been <none>, but the conversion changed it to _x003C_none_x003E_. I opened the flat file connection manager and changed the text qualifier property on the general tab back to the proper value of <none>.
Credit goes to this thread for providing the answer.
I had a similar issue. My flat file didn't had any text qualifiers. When i added a text qualifier the package ran successfully. My guess is that the file is read as text and the CRLF is not recognized at the last line.
If you can provide a sample of the data from the file
I want to upload 1000 CSV file to a single table in MSAccess. Could someone help me with macro for that.
First make sure your CSV is fit to upload - no blank lines, no blank colums, column headers worded to suit Access (No spaces, no Reserved words, no barred characters). Then in the access ribbon click External data, select the file type you are importing, then browse to the file and create a new table. You will have to help access with the data types during the import process.
I'm going to be getting a new computer soon and I don't want to lose all of the data I have entered in my tables, so I decided to test out the feature that allows you to export and import CSV files. I exported a table successfully (data was transferred to Microsoft Excel in CSV file), but when I opened the file in Microsoft Excel and added a few rows and tried to import it back in to MySQL Workbench, I got the following error:
"Error importing recordset
error calling Python module function
SQLIDEUtils.importRecordsetDataFromFile"
I've searched all over for info on this, but can't find any solutions. Does anyone know what I'm doing wrong?
In Workbench, open a MySQL connection and then navigate to [Server] --> [Data Export]. There are several backup options here, including saving the data as an individual file or folder. Choose the databases you want to export, and then click [Start Export].
If you ever prefer using Excel for editing and such, then use the MySQL for Excel plugin to access MySQL databases from within Excel. However, I don't think you need it here.
To export your mySQL data, use mysqldump, which will create all the schema for you.
Excel probably added some stuff to your file and now mySQL can't understand it. The best way to find out is by comparing the files before and after the change.
That error indicates a format problem. If the file is small enough, try opening it in wordpad (or the mac equivalent) and see if there's any difference in the formatting? Could be that the delimiting got a little messed up (this can happen especially with end of row markers in MySQL, I've noticed, it can also happen in mac to pc handoffs). If all else fails you could try exporting using a different format and see if that makes a difference (maybe tsv) when you add new rows.
Another reason can be the line endings used. Depending on the system and editor used to work with the cvs file it the line endings might get changed. For me mysql supported UNIX line endings. And in the editor the line ending had been set to MAC OS 9 since I was using a MAC.
Changing it to UNIX line ending worked.
I found that it might be due to a wrong encoding of the input file.
Using Notepad++ for example (or another similar editor) you need to change file encoding to UTF-8.