By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,950 Members | 1,035 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,950 IT Pros & Developers. It's quick & easy.

How to copy data from one table to other table

100+
P: 111
HII all,
im working on postgresql database where i want to copy the data from one table to other table....

when im trying to write the sql query..

ERROR: 42601: syntax error at or near "ABH0001" at character 701
LOCATION: yyerror, scan.l:609

In statement:
COPY "Tbl_Students_Dalitch" ("Student_Code", "Project_Location", "Student_Name", "Date_of_Birth", "Gender", "Father_Name", "Father_Occupation", "Mother_Name", "Mother_Occupation", "Family_Income", "Religion", "Caste", "Family_Members", "Family_Background", "Height", "Weight", "General_Health", "Recent_Illness", "Health_Comments", "Date_of_Admission", "Class_of_Admission", "Present_Class", "Staff_Firstname", "Subject_Name", "Sport_Name", "Exam_Performance", "Academic_Comments", "Cocurricular_Activities", "Photograph", "Info_Date", "Comments", "Corrections", "Reports", "Letters", "Status", "Approved", "Changed_Status", "Posted_On", "Live_Status", "Website_Name", "Sponsor_Status") FROM stdin;
ABH0001 Abohar B 1999-08-08 M Shagan Lal Police Constable Surjeet Kaur Housewife 3000.00 Hindu Scheduled Caste 5: Father, Mother, Manjeet (elder sister), Ravinder (elder brother) and Bhuperder. Bhupender`s father is a Police constable. Though he earns a good salary, he spends most of the money in drinking. His grand mother also stays with them. Both his brother and sister go to school. 97 13 Healthy - - 2003-07-14 LKG LKG Nemneih Kim Hindi Athletics C Must work hard He is interested in drawing. 1 2005-08-01 SUCCESS-Update \N \N \N 0 1 N 2007-06-07 Y dalitchild.com 0

IM GETTING THE ERROR AT FROM stdin;

can anyone help me out with this error..???


THNX......
Jun 7 '07 #1
Share this Question
Share on Google+
1 Reply


Expert 100+
P: 534
You did not specify a delimiter to the COPY command, so make sure that all values in the list are separated with a tab.
I'm pretty sure that working in text mode you also need to terminate the input with \. (backslash-period) combination, and keep each record on a separate line.

If this does not help you may get more info from the COPY man page.

By the way, if both tables live in the same database you don't need to use the COPY command.
Jun 10 '07 #2

Post your reply

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