473,382 Members | 1,107 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

syntax for copy command

priyan
54
hai everybody,
I need to copy data from a text file to a table i used copy command
like this
Expand|Select|Wrap|Line Numbers
  1.  
  2. copy city from 'e\ccccc.txt' with delimiter as ','
  3.  
it worked successfully. But now i need to copy a data from a text file which is in my system to the database in server..

path of the file in my system is
Expand|Select|Wrap|Line Numbers
  1. \\ttcpl2\e\ccccc.txt
  2.  
if use copy command like this
Expand|Select|Wrap|Line Numbers
  1. copy city from '\\Ttcpl2\e\ccccc.txt' with delimiter as ','
  2.  
I got an error
Expand|Select|Wrap|Line Numbers
  1. WARNING:  nonstandard use of \\ in a string literal
  2. LINE 1: copy city from '\\Ttcpl2\e\ccccc.txt' with delimiter as ','
  3.                        ^
  4. HINT:  Use the escape string syntax for backslashes, e.g., E'\\'.
  5.  
  6. ERROR: could not open file "\Ttcpl2eccccc.txt" for reading: No such file or directory
  7. SQL state: 58P01
  8.  
  9.  
If i use /copy command
Expand|Select|Wrap|Line Numbers
  1. \COPY city FROM '\\ttcpl2\e\ccccc.txt '  WITH DELIMITER  ',' 
  2.  
Expand|Select|Wrap|Line Numbers
  1. ERROR: syntax error at or near "\"
  2. SQL state: 42601
  3. Character: 1
  4.  
Please help me as soon as possible..........
Aug 14 '07 #1
3 12150
michaelb
534 Expert 512MB
Try either to double the backslashes (use \\\\ instead of \\) or replace them with forward-slashes, that is use "/" in place of "\"
Aug 14 '07 #2
priyan
54
hai everybody,
I need to copy data from a text file to a table i used copy command
like this
Expand|Select|Wrap|Line Numbers
  1.  
  2. copy city from 'e\ccccc.txt' with delimiter as ','
  3.  
it worked successfully. But now i need to copy a data from a text file which is in my system to the database in server..

path of the file in my system is
Expand|Select|Wrap|Line Numbers
  1. \\ttcpl2\e\ccccc.txt
  2.  
if use copy command like this
Expand|Select|Wrap|Line Numbers
  1. copy city from '\\Ttcpl2\e\ccccc.txt' with delimiter as ','
  2.  
I got an error
Expand|Select|Wrap|Line Numbers
  1. WARNING:  nonstandard use of \\ in a string literal
  2. LINE 1: copy city from '\\Ttcpl2\e\ccccc.txt' with delimiter as ','
  3.                        ^
  4. HINT:  Use the escape string syntax for backslashes, e.g., E'\\'.
  5.  
  6. ERROR: could not open file "\Ttcpl2eccccc.txt" for reading: No such file or directory
  7. SQL state: 58P01
  8.  
  9.  
If i use /copy command
Expand|Select|Wrap|Line Numbers
  1. \COPY city FROM '\\ttcpl2\e\ccccc.txt '  WITH DELIMITER  ',' 
  2.  
Expand|Select|Wrap|Line Numbers
  1. ERROR: syntax error at or near "\"
  2. SQL state: 42601
  3. Character: 1
  4.  
Please help me as soon as possible..........

i have did as if u have said
Expand|Select|Wrap|Line Numbers
  1. \COPY city FROM '//ttcpl2/e/ccccc.txt '  WITH DELIMITER  ',';
  2.  
Expand|Select|Wrap|Line Numbers
  1. ERROR: syntax error at or near "\"
  2. SQL state: 42601
  3. Character: 1
  4.  
  5.  
Aug 15 '07 #3
michaelb
534 Expert 512MB
i have did as if u have said
Expand|Select|Wrap|Line Numbers
  1. \COPY city FROM '//ttcpl2/e/ccccc.txt '  WITH DELIMITER  ',';
  2.  
Expand|Select|Wrap|Line Numbers
  1. ERROR: syntax error at or near "\"
  2. SQL state: 42601
  3. Character: 1
  4.  
Why do you have a backslash at the beginning of your command?
Aug 15 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Sarah | last post by:
Hi! I have perhaps a strange question... I have a javascript that activates on a right click and shows the user a little menu of links. However, by doing so, it disables the users ability to...
2
by: Don Isgitt | last post by:
Hi, I am recreating a database and its applications onto a new server and new software; old version of pg was 7.2.4 and new version is gds2=# select version(); version ...
2
by: J M | last post by:
How do I run following from csharp from "server"? copy file.txt \\server\printer1 Also how can I submit a text file print job to local print queue "printer1"? Assuming I run copy command from...
1
by: Bob Powell | last post by:
To whom it may concern: Does anyone know if it is possible to make the COPY command in postgres verbose. It would be very helpful if an error would generate when something goes wrong with a...
4
by: Jon Asher | last post by:
Hi, I'm trying to do a simple import of a comma delimited text file with COPY but it's returning an error. The file has been granted all permissions in Linux, so it's not clear to me what the...
0
by: Robert Fitzpatrick | last post by:
I have a PHP script that was having problems using the COPY command with files around 1500 lines in size. The script will build the copy data from incoming CSV file into a temp file, then start a...
3
by: devinath | last post by:
I came across a problem while running the system file. When the copy command is run using system command , it doesn’t copy files which have size of 0kb. But the same command works if run thru the...
1
by: coolminded | last post by:
can we use the copy command to copy it in the local disk copy temp_swap TO ''c:\folder_name\";
1
by: ibo3 | last post by:
I used the copy command as stateed below, to copy a file containing data, which I want to load into my evaluations table. I get the following error, can some one explain to me what I may be doing...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.