When I export an query result to a csv format flat file in ms access, the text fields are enclosed in quotes. Is it possible to export the text fields values without quotes?
Yes it is possible:
During the export process flow you will have the option to select your own custom formatting and layout. Select this check box and then you will have the opportunity to select whatever delimiter you see fit. See this article for further information.
Here is also an example of how you can write it to a file manually using VBA.
Enjoy!
Related
We have a .txt file with encoding UTF-16 LE (discussed here, as well). We need to load this file into an Azure SQL database. We are first trying to convert this file to a csv format by using Text Import Wizard of Data Excel 365 wizard. But if we use the ^|^,^|^ as a custom delimiter, the first and last columns still end up with ^|^ value.
Question: What may be possible solutions/work arounds for converting this type of file to csv?
Remarks: This is a huge file (1GB) with about 150 columns. Following is just a sample for explaining the scenario in this post.
Sample of the txt file:
^|^Col0^|^,^|^Col1^|^,^|^Col2^|^,^|^Col3^|^,^|^Col4^|^,^|^Col5^|^,^|^Col6^|^,^|^Col7^|^
^|^1234^|^,^|^4600869848^|^,^|^6000.00^|^,^|^2021-12-20 10:16:19.3600000^|^,^|^False^|^,^|^^|^,^|^^|^,^|^2^|^
^|^5431^|^,^|^3425143451^|^,^|^30000.00^|^,^|^2021-12-13 10:27:44.9030000^|^,^|^False^|^,^|^^|^,^|^^|^,^|^2^|^
.....................
............................
After using the delimiter ^|^,^|^ in Excel text import wizard
Instead of mentioning the ^|^,^|^ as custom delimiter, you can mention comma as a delimiter, that will give you a result like below:
Then you can record a macro to replace the desired characters which is ^|^ after importing is done as mentioned in below link:
Create A Macro Code To Achieve Find And Replace Text In Excel
I'm trying to do an export from access into a text file via a query
select CustomerName
into [Text;FMT=TabDelimited;HDR=NO;DATABASE=C:\Temp\;].CustomerList.txt
from Customer
however, every line is getting wrapped in double quotes. Is there a way to turn off the quoting (I'm only ever setting one column), or can I use a custom quote character (e.g. set it to blank)?
Method 1
You have to add manually a schema.ini in the directory you wish to export
In your case, it should contain :
TextDelimiter="none"
Method 2
Another way to do it is to use the TransferText method, with :
SpecificationName Optional Variant. A string expression that's the
name of an import or export specification you've created and saved in
the current database. For a fixed-width text file, you must either
specify an argument or use a schema.ini file, which must be stored in
the same folder as the imported, linked, or exported text file. To
create a schema file, you can use the text import/export wizard to
create the file. For delimited text files and Microsoft Word mail
merge data files, you can leave this argument blank to select the
default import/export specifications.
for your export specification, which is a oneshot operation, you will use the wizard and there you have an "advanced" button bringing a menu where you can set the text delimiter to nothing.
Google is your friend. You've got enough clues now to sort it out.
(SQL Server 2008)
So here's my task ..
I need to export query results to file, and then import that file using SSIS to another DB.
Specific to the task, the data contains every awkward unicode character you can think of, so delimiting with commas, pipes etc is out of the question.
Here are the options SSMS gives me for export format:
Column Aligned
Comma/Tab/Space delimited
Custom delimiter
And here are the options SSIS gives me for a flat file data source:
Delimited (custom)
Fixed Width
Ragged Right
So given that a delimiter character is out of the question ... I cannot see another method that both SSMS & SSIS agree on.
Such as fixed width ?
Seems strange that the 2 closely related MS products have such different options.
Or have I missed something here ?
Any advice appreciated !!
It seems you need to try out different combination of options while creating delimited flat file(for your exported query result).
Try setting Code page to UTF-8 with and without Unicode. Also use Text qualifier as " or any of your choice which you thought might work. Also try using different option for column delimiter.
Once you are able to create delimited file then you have to apply same setting on file while importing to another DB.
I am doing an export from a MySQL result-set and what I am finding in the .txt file when I open it in Notepad++ is there are fields that looked like this Top Side Panel w/ Bracket, Left now look like this "Top Side Panel w/ Bracket, Left" with extra quotes.
This is only happening on the fields with a comma in them. So it does not occur on a record with this in the same field for example: Rear Baffle
How do you do a correct Tab Delimited export from MySQL Query Browser 1.2.17 where we do not get added data!?
Thank you.
You can use MySQL's SELECT INTO OUTFILE syntax to give you a native MySQL way to generate CSV or TSV files. This command gives you full control over how you delineate and escape your fields. See the link below for documentation.
http://dev.mysql.com/doc/refman/5.5/en/select-into.html
I recommend to use phpMyAdmin. It offers an export tool that exports csv for MS Excel.
I want to export the database to CSV file and read in MatLab.
I use phpMyAdmin to export to CSV file, but each field is with quotes, so that MatLab cannot correctly read it.
How can I export CSV file without quotes?
update
And how to use SQL command to export?
Depends on what version of phpMyAdmin you're using. In 3.4.9 (the latest release as of today), You'd select Export, Custom - display all possible options radio button, Format CSV, and just erase the Columns enclosed with: field.
This is offtopic, but still: in PHPMyAdmin, if you use 'csv' as export, you can set the "Fields enclosed by" option to from " to nothing, right?