Re: Query regarding Insert Statement!!!!

From: "Juliet May" <jmay(at)speark(dot)com>
To: "sandeep bantia" <s_bantia(at)yahoo(dot)co(dot)in>, <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Query regarding Insert Statement!!!!
Date: 2003-05-16 17:56:08
Message-ID: 001901c31bd4$6de7a460$a1d2a8c0@impsu.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

The syntax for the insert query does not use set or parenthesis. Your query
should have looked like:
INSERT INTO TABLENAME(COL_NAME1,COLNAME_NAME2,
... )values('VALUE1','VALUE2'...);

or
INSERT INTO TABLENAME(COL_NAME1,COLNAME_NAME2, ... ) (select
COL_NAME1,COLNAME_NAME2, ... FROM SOMETABLE);

Hope that helps.

Be sure to check out the online documentation. It gives the sql syntax that
PostgreSql uses. http://www.postgresql.org/docs/

Julie

----- Original Message -----
From: "sandeep bantia" <s_bantia(at)yahoo(dot)co(dot)in>
To: <pgsql-novice(at)postgresql(dot)org>
Sent: Tuesday, May 13, 2003 7:52 AM
Subject: [NOVICE] Query regarding Insert Statement!!!!

Hi everybody,
This would seem a very fundamental doubt to you all
and might've been addressed before too, but I couldn't
find it on the mailing lists, so had to put on the
mailing list.
My question to all of you is as follows:
I tried to insert a row into a table of my database
in the following format:
INSERT INTO TABLENAME SET
(COL_NAME1='VALUE1',COLNAME_NAME2='VALUE2'...);
but this doesn't seem to work and i get the message
that "parse error at or near set"

I also tried this query,
INSERT INTO TABLENAME SET values
(COL_NAME1='VALUE1',COLNAME_NAME2='VALUE2'...);
but this too doesn't work!!!
I think this type of insert statement is supported in
MySQL,but not very sure about PostGreSQL.

I use postgresql7.2.3 on linux.

Please do reply to my query.
Thanks in advance.
Sandeep!!!

________________________________________________________________________
Missed your favourite TV serial last night? Try the new, Yahoo! TV.
visit http://in.tv.yahoo.com

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
message can get through to the mailing list cleanly

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Nabil Sayegh 2003-05-16 18:41:02 Re: SELECT across multiple db
Previous Message Manfred Koizar 2003-05-16 17:49:13 Re: Problems with join (no such attribute, but it exists)