Proper CSV export from SQL Server - sql

I have a table in SQL Management Studio I want to export as a CSV and afterwards import it into WEKA.
I queried all data from the table, selected it, then right-clicked and chose "Save results as"->CSV.
When I try to import this CSV into WEKA, I get the following error message:
File <path> not recognized as an 'CSV data files' here.
Reason:
wrong number of values. READ 27, expected 26, read Token[EOL], line 1023
I assume, I need to escape a String at line 1023, but what if another 100... errors will follow?
Is there any way to automatically escape all characters to get a proper CSV file, without post-processing?

Related

Can't update CSV file to BQR

I tried to update manually this data sample to BigQuery (after tried to update from Google Cloud, I extracted some rows to detect what's the problem). I met these errors:
Error while reading data, error message: CSV table encountered too many errors, giving up. Rows: 1; errors: 1. Please look into the errors[] collection for more details.
Error while reading data, error message: CSV table references column position 77, but line starting at position:0 contains only 56 columns.
My sample data is: https://drive.google.com/file/d/1v8jcIKSY7HiOpdc40BFJXACvgX8prWm0/view?usp=sharing
Please use the following steps to resolve the issue:
Download the file from Google Drive
Open the File and Save As "CSV UTF-8 (Comma delimited) (*.csv)"
Open BigQuery and upload CSV file with "Auto detect" schema

I am getting the error message "ERROR: invalid byte sequence for encoding "WIN1251": 0x00"

I am trying to load the CSV to my postgres database but I am getting the above error message:
My query is :
COPY dbo.tbl(col1,col2)
FROM 'C:\Data\dbo.tbl.csv' DELIMITER ',' null as 'null' encoding 'windows-1251' CSV;
I tried this link for reference:https://www.postgresqltutorial.com/import-csv-file-into-posgresql-table/'
Can someone please help me what is the issue. I am new to postgres database.
For my experience, I have csv file with encoding 'WIN874' and postgres client encoding is 'UTF-8'. I can use copy command without problems.
To make sure that your file encoding is 'WIN1251', you can open your csv file in visual studio code. It will show file encoding on the right bottom pane.

importing training data to CloudML with images that do not have a file-extension

i created some training data and put the CSV in the google-storage, but it looks like the import won't work when the files do not have a proper .jpg extension:
Error: INVALID_ROW: Invalid input found at row 1 of gs://weg-li-production/training/test.csv: "Unsupported file extension."
values look like this:
TRAIN,gs://weg-li-production/d7nwcheo8774rvbcgj4lyta3athj,Opel
is there a way to work around this issue?
It seems you put the whole "TRAIN,gs://weg-li-production/d7nwcheo8774rvbcgj4lyta3athj,Opel" into a single unit in your csv file. The comma should represent another unit in the csv file. You can open it in Excel to check your csv file, and the correct format should include three columns in Excel.
Assuming gs://weg-li-production/d7nwcheo8774rvbcgj4lyta3athj is the image file & Opel is the label. It all looks fine, just that the image file name does not have a valid extension.
Check https://cloud.google.com/vision/automl/docs/prepare for valid file types (extension), during training & predictions

How to fix error problem when i import excel to postgresql?

I am trying to import an excel file with some Japanese data in it. I tried solutions that use COPY, use pgadmin import but I always end with an error message:
C:/Users/設備53/Desktop/Book4.csv : Invalid argument
and for the way using copy:
ERROR: could not open file "C:\Users\設備53\Desktop\Book4.csv" for reading:
No such file or directory
SQL state: 58P01
I I tried many little things e.g. be careful of the encoding, changing the security parameter etc that I saw on the net.

Import Data From CSV Using Control File Is failing

I am importing CSV file into HANA server using control file using hdbsql and for that purpose i am using IMPORT FROm CSVs statements into control file. My HANA Studio file import is working fine but when i am trying to import through hdbsql using control file as input , my import is failing for no reason, no error.
My CSV file is record delimited {CR}{LF} and i am using '\r\n' as record delimited separator and this file is UTF-16LE encoded.
Just add to #LarsBr. comment, you also need to be careful on where you will load the file from.
It needs to be in a specific directory or you will need to adjust the configuration to use a different one.
Here is a tutorial I wrote to explain that: https://developers.sap.com/tutorials/mlb-hxe-import-data-sql-import.html
There is a "ERROR LOG" option available as well documented here: https://help.sap.com/viewer/4fe29514fd584807ac9f2a04f6754767/latest/en-US/20f712e175191014907393741fadcb97.html