Re: [SQL] UPDATE Multiple Records At Once?
Carlos Mennens wrote on 11.04.2012 19:50: I'm trying to update a customer record in a table however I need to change several values (cust_address, cust_contact, cust_email). My question is how do I properly format this into one single command? forza=# SELECT cust_id, cust_name, cust_address, cust_contact, cust_email forza-# FROM customers forza-# WHERE cust_name = 'iamUNIX' forza-# ; cust_id | cust_name | cust_address | cust_contact | cust_email +---+---++ 16 | MobileNX | 200 South Shore Drive | Carlos Mennens | car...@mobilenx.com (1 row) I did a quick Google search and I can see there is a method or procedure which involves parenthesis () however I'm not sure how I would change all the values listed above under one command. Can anyone please give me a quick example so I can see how this is drawn out via ANSI SQL? UPDATE customers SET cust_address = 'foo', cust_contact = 'Arthur', cust_email = 'art...@foo.bar' WHERE cust_name = 'iamUNIX' -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql
Re: [SQL] Re: Pregunta acerca de la función COPY de POSTGRES
Estas tratando de realizar esta operacion desde un stored procedure? Si es asi, investiga como se hace para concatenar variables tipo character. Creo que simplemente poner tu variable en un comando no es suficiente. Saludos, Edward Ross On 04/11/2012 10:42 AM, yeison garcia wrote: Buenas tardes. Mi nombre es Yeison Garcia Escobar. Estoy dando mis primeros pasos en postgres y tengo la tarea de investigar las cargas masivas. Estuve buscando y encontre la función COPY FROM, la cual es excelente. Al usar copy _edb_scheduler.persona from 'C:/persona.txt' using delimiters ',' ; funciona correctamente. Sin embargo, yo necesito que la ruta sea guardada en una variable. Ejemplo: Tengo la variable ruta character; ruta := 'C:/persona.txt'; al usar copy _edb_scheduler.persona from ruta using delimiters ',' ; me sale un error indicando un error de sintaxis indicando que la variable ruta no debe estar ahí. La pregunta es: ¿Como puedo hacer para que la función COPY tome la información que esta en una variable? Muchas gracias por la ayuda que me puedan brindar.
[SQL] UPDATE Multiple Records At Once?
I'm trying to update a customer record in a table however I need to change several values (cust_address, cust_contact, cust_email). My question is how do I properly format this into one single command? forza=# SELECT cust_id, cust_name, cust_address, cust_contact, cust_email forza-# FROM customers forza-# WHERE cust_name = 'iamUNIX' forza-# ; cust_id | cust_name | cust_address | cust_contact | cust_email +---+---++ 16 | MobileNX | 200 South Shore Drive | Carlos Mennens | car...@mobilenx.com (1 row) I did a quick Google search and I can see there is a method or procedure which involves parenthesis () however I'm not sure how I would change all the values listed above under one command. Can anyone please give me a quick example so I can see how this is drawn out via ANSI SQL? -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql
[SQL] Re: Pregunta acerca de la función COPY de POSTGRES
> > Buenas tardes. > Mi nombre es Yeison Garcia Escobar. > > Estoy dando mis primeros pasos en postgres > y tengo la tarea de investigar las cargas masivas. > > Estuve buscando y encontre la función > COPY FROM, la cual es excelente. > > Al usar > copy _edb_scheduler.persona from 'C:/persona.txt' using delimiters ',' ; > funciona correctamente. > > Sin embargo, yo necesito que la ruta sea guardada en una variable. > > Ejemplo: > > Tengo la variable > ruta character; > ruta := 'C:/persona.txt'; > > al usar copy _edb_scheduler.persona from ruta using delimiters ',' ; > > me sale un error indicando un error de sintaxis indicando que la variable > ruta no debe estar ahí. > > La pregunta es: > ¿Como puedo hacer para que la función COPY tome la información que esta en > una variable? > > Muchas gracias por la ayuda que me puedan brindar. > >
Re: [SQL] sintax error
kevalshah writes: > At present whenever there is any error in syntax of fired query > i get error message in terms of charcter "at char 53 " > I also would like to have line no: from psql terminal.. Umm ... any reasonably recent version of psql will show syntax errors like this: regression=# select 1/ from foo; ERROR: syntax error at or near "from" LINE 1: select 1/ from foo; ^ If you're using something so old that it doesn't do that, the answer is to update. regards, tom lane -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql
Re: [SQL] sintax error
Hi All, I am using postgres sql. At present whenever there is any error in syntax of fired query i get error message in terms of charcter "at char 53 " I also would like to have line no: from psql terminal.. I tried making changes in scan.l Do u have any suggestive fix ? to get error as "at char 54 line no 2" Regards, keval -- View this message in context: http://postgresql.1045698.n5.nabble.com/sintax-error-tp2154517p5632590.html Sent from the PostgreSQL - sql mailing list archive at Nabble.com. -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql