473,750 Members | 2,170 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

syntax for copy command

priyan
54 New Member
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 12184
michaelb
534 Recognized Expert Contributor
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 New Member
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 Recognized Expert Contributor
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
3033
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 use the Copy Command when doing a normal right click. I know that in some cases this would be good for someone who wants to make it harder to copy pictures from their site... but in this case I WANT people to be able to copy the pictures....
2
9735
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
4117
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 server. TIA!
1
2852
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 COPY. In the case of an extraneous comma or quote, it would identify the offending record. Thanks Bob Powell
4
7039
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 problem is. Version 7.41 is installed... see below for details: A comma delimited text file has been placed in a local directory with permissions set to allow any user to read or write to it: /root/Desktop/server_transfer/WorldPoints_v2.txt'
0
2767
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 COPY command and loop through the copy data using pg_put_line to insert and then pg_end_copy after posting the last line as '\.'. Worked well under that 1500 line area. What I found was if I issue a pg_connection_busy($dbh) before the...
3
1862
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 dos prompt , which is activated thru windows command prompt. pls let me know if there is some other way out.. regs devinath
1
2278
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
13502
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 wrong. COPY evaluations FROM 'c:\evaluations.txt' DELIMITERS ':'; WARNING: nonstandard use of escape in a string literal LINE 1: COPY evaluations FROM 'c:\evaluations.txt' ^ HINT: Use the escape string...
0
8999
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9575
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9394
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9256
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8260
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6080
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4712
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4885
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3322
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.