Error during import csv file into PgAdmin table - database

When I'm trying to import csv file's table into PgAdmin, it's being error.
ERROR: could not open file "D:\book.csv" for reading: No such file or
directory
HINT: COPY FROM instructs the PostgreSQL server process to read a
file. You may want a client-side facility such as psql's \copy.
SQL state: 58P01

Related

Importing data into singlestore db using csv

I am new to MEMSQL and trying to restore data into MEMSQL db using .csv file but its below error
ERROR 1017 ER_FILE_NOT_FOUND: Can’t find file: ‘\home\vagrant\filename.csv’ (errno: 2)
CSV data is imported from another server.
I have memsql on virtual machine.
I have copied table dump csv to \home\vagrant\ location.
I am trying below command to restore data.
LOAD DATA INFILE ‘\home\vagrant\filename.csv’ INTO TABLE “tableName” FIELDS TERMINATED BY ‘\t’ LINES TERMINATED BY ‘\n’;
Thanks in advance
Just to clarify, the filename.csv file is located inside the virtual machine running memsql or is located on same machine your running the LOAD DATA from?
If the file is on the same machine your running LOAD DATA from you need to add the LOCAL keyword (LOAD DATA LOCAL INFILE ...)

Bulk importing to SQL Server from a remote data file using UNC paths

As mentioned on the MSDN for bulk import, I tried to use UNC path for importing data but it fails.
SELECT
'\\FS1-CBR.strange.ibm.au\{fu-spec}\work\Proj1 Vis-NIR_all\New South Wales\file1.asd',
* FROM OPENROWSET(BULK N'\\FS1-CBR.strange.ibm.au\{fu-spec}\work\Proj1 Vis-NIR_all\New South Wales\file1.asd', SINGLE_BLOB) AS FileData
It fails with error:
Cannot bulk load because the file
"\FS1-CBR.strange.ibm.au{fu-spec}\work\Proj1 Vis-NIR_all\New
South Wales\file1.asd" could not be opened. Operating system error
code 5(Access is denied.).
I guess it is failing due to the substring {fu-spec} in the UNC path. I can access the file through file explorer as well as programmatically as I have the permissions to this location.
How to import the file in this case using OPENROWSET BULK in SQL Server?

Error while trying to create table in MSSQL using flat-file import

I am trying to import a .csv file to SQL Server Native 11.0 in order to create a table.
However, I am getting the following error:
Warning 0x80070020: Data Flow Task 1: The process cannot access the file
because it is bein gused by another process.
Error 0xc020200e: Data Flow Task 1: Cannot open the datafile
Following the the .csv data:
Need help in figuring out the solution for these errors.
Issue: This was happening because I have opened the .csv file in excel and at the same time I was trying to import it to SQL Server.
Solution: Try closing the file before importing. It should work then, as it worked for me.

Bulk insert is not working in MS SQL Server

Bulk insert is not working when I try to read in the .CSV file data from the network path, it throws an error message saying
Cannot bulk load because the file couldn't be opened Operating system error code 5 (Access is denied)
If I try to bulk insert the same file data from the local drive of the server where SQL Server is running, it works fine without any issue. I checked the access rights with the network path, I do have full access. I need help to resolve this issue.
The data file name must specify a valid path from the server on which SQL Server is running.
If the data file is a remote file, specify the Universal Naming Convention (UNC) name.
A UNC name has the form :
\\Systemname\ShareName\Path\FileName.
For example,
\\SystemX\DiskZ\Sales\update.txt.
For more details: https://learn.microsoft.com/en-us/sql/t-sql/statements/bulk-insert-transact-sql?view=sql-server-2017

SQL Server Bulk Insert Http file

I am trying to bulk insert a csv file located on a remote web server but i am getting the following error.
Cannot bulk load because the file "http://34.34.32.34/test.csv" could
not be opened. Operating system error code 123(The filename, directory
name, or volume label syntax is incorrect.).
Is there anyway to accomplish this?
The documentation for BULK INSERT says nothing about SQL Server being able to connect to web servers.
http://msdn.microsoft.com/en-us/library/ms188365.aspx
' data_file ' Is the full path of the data file that contains data to
import into the specified table or view. BULK INSERT can import data
from a disk (including network, floppy disk, hard disk, and so on).
data_file must specify a valid path from the server on which SQL
Server is running. If data_file is a remote file, specify the
Universal Naming Convention (UNC) name. A UNC name has the form
\Systemname\ShareName\Path\FileName. For example,
\SystemX\DiskZ\Sales\update.txt.
If you must import a file from HTTP, consider writing a CLR stored procedure or using SSIS' external connectivity capabilities.
http://34.34.32.34/test.csv is, exactly as the error message says, an incorrect file name. Correct filenames look like c:\somefolder\test.csv. Something that starts with http: is an URL, not a file.
BULK INSERT does not support URLs as source. You should download the file first locally (using wget, curl or any other program that can download HTTP content), then bulk insert the downloaded file.

Resources