Re: [SQL] Problem -Postgre sql

2005-10-18 Thread Chris Travers
Correct me if I am wrong, but isn't COALESCE standard in this way? Best Wishes, Chris Travers Metatron Technology Consulting Michael Glaesemann wrote: [Please do not email me directly. Please post to the list so others may help and benefit from the discussion.] On Oct 19, 2005, at 14:30 , V

Re: [SQL] problems with array

2005-10-18 Thread Matthew Peter
Ya, I didn't test it. The error message was expecting an integer not an array, so coverting it to a list crossed my mind 'assuming' the subselect 'could' return a string of integers for the IN clause. Oh well. I'm glad there's people like you test it. --- Michael Fuhr <[EMAIL PROTECTED]> wrote:

Re: [SQL] query to file

2005-10-18 Thread Eugene E.
Judith Altamirano Figueroa wrote: Excuse me, how can I send a query to a file?, for example the result of this query: select id_articulo, articulo, color_code from articulos; if you mean psql \o filename and try to read output of a command \? ---(end of broadcast)---

Re: [SQL] Problem -Postgre sql

2005-10-18 Thread Michael Glaesemann
[Please do not email me directly. Please post to the list so others may help and benefit from the discussion.] On Oct 19, 2005, at 14:30 , Vikas J wrote: IsNull in sql server has syntax like isnull(column,substitute) if "column" is null it shows value of "substitute". That can be achieved

Re: [SQL] problems with array

2005-10-18 Thread Michael Fuhr
On Tue, Oct 18, 2005 at 08:09:48PM -0700, Matthew Peter wrote: > Not sure if you got this figured out but I think > > SELECT * from tb_cat WHERE id IN (SELECT > array_to_string(cat,',') as cat FROM tb_array WHERE > id=1); > > is what your looking for? I doubt it, considering that it doesn't work

Re: [SQL] problems with array

2005-10-18 Thread Matthew Peter
Not sure if you got this figured out but I think SELECT * from tb_cat WHERE id IN (SELECT array_to_string(cat,',') as cat FROM tb_array WHERE id=1); is what your looking for? --- paperinik 100 <[EMAIL PROTECTED]> wrote: > PostgreSQL is 7.4.7. > > My first table > CREATE TABLE tb_cat ( > id I

Re: [SQL]

2005-10-18 Thread Scott Marlowe
On Thu, 2005-10-13 at 10:31, Shavonne Marietta Wijesinghe wrote: > how can i do a query with 2 databases?? This is only supported by an add on called dblink, and it's a little bit klunky. Could schemas solve your problem? ---(end of broadcast)--- T

Re: [SQL] Problem -Postgre sql

2005-10-18 Thread Michael Fuhr
On Tue, Oct 11, 2005 at 12:50:49PM +0530, Vikas J wrote: > I want to know substitute function for sql server ISNULL() function in postgre If you look in the index of the PostgreSQL documentation you'll find an entry for ISNULL: http://www.postgresql.org/docs/8.0/interactive/bookindex.html If Pos

Re: [SQL] query to file

2005-10-18 Thread Michael Glaesemann
On Oct 19, 2005, at 8:03 , Judith Altamirano Figueroa wrote: Excuse me, how can I send a query to a file?, for example the result of this query: select id_articulo, articulo, color_code from articulos; You don't mention what client you're using. In psql, you can use \o path/to/file.txt F

Re: [SQL] query to file

2005-10-18 Thread Michael Fuhr
On Tue, Oct 18, 2005 at 06:03:59PM -0500, Judith Altamirano Figueroa wrote: > Excuse me, how can I send a query to a file?, for example the result of > this query: > > select id_articulo, articulo, color_code from articulos; If you have a shell on a platform that supports input/output redirection

[SQL] query to file

2005-10-18 Thread Judith Altamirano Figueroa
Excuse me, how can I send a query to a file?, for example the result of this query: select id_articulo, articulo, color_code from articulos; ---(end of broadcast)--- TIP 9: In versions below 8.0, the planner will ignore your desire to choos

Re: [SQL] What Am I Doing Wrong?

2005-10-18 Thread Michael Fuhr
On Tue, Oct 18, 2005 at 03:38:54PM -0400, Lane Van Ingen wrote: > select EXTRACT(EPOCH from TIMESTAMP current_timestamp) - EXTRACT(EPOCH from > TIMESTAMP updated_time) ::integer > > ERROR: syntax error at or near "current_timestamp" at character 37 What are you intending "TIMESTAMP" to do? If y

Re: [SQL] Problem -Postgre sql

2005-10-18 Thread Michael Glaesemann
[It's PostgreSQL, Postgres, or pgsql. It's never "postgre"] On Oct 11, 2005, at 16:20 , Vikas J wrote: Hi I want to know substitute function for sql server ISNULL() function in postgre I'm not quite sure what the ISNULL() function does in SQL Server, but it sounds like it might be similar

Re: [SQL] Query information needed

2005-10-18 Thread Michael Glaesemann
On Oct 13, 2005, at 21:50 , [EMAIL PROTECTED] wrote: Dear all, I have a table created with this specifications: CREATE TABLE cdr ( calldate timestamp with time zone NOT NULL default now(), clid varchar(80) NOT NULL default '', src varchar(80) NOT NULL default '', dst varchar(80) NOT N

Re: [SQL] Problem while using start transaction ans commit;

2005-10-18 Thread Stewart Ben (RBAU/EQS4) *
Sri, > I have a small problem in using nested transactions while > working on Postgres 8.0. This is a known problem with Postgres 8.0 - there is no support for nested transactions (which occurs when calling functions). Your best bet would be to raise an exception within B or C - this will cause

[SQL] Double query (limit and offset)

2005-10-18 Thread Michael Landin Hostbaek
List, I'm using the OFFSET / LIMIT combo in order to split up my query, so it only parses 20 rows at a time (for my php-scripted webpage). I'm using two queries; the first basically doing a select count(*) from [bla bla]; the second grabbing the actual data while setting LIMIT and OFFSET. In a

[SQL] Very Urgent Req for SQL-DBS In Chennai

2005-10-18 Thread farhin
Hi All, We are having an opening for SQL-DBS for my CMM Level 5 Client in Chennai Skills : SQL-DBS Exp : 1+yrs Location : Chennai Kindly send us your updated resume [EMAIL PROTECTED] farzana@(at)shubhaminfo.(dot)com In case you are interested, kindly send us the following i

[SQL] Problem -Postgre sql

2005-10-18 Thread Vikas J
Hi I want to know substitute function for sql server ISNULL() function in postgre   Regards,Vikas Jadhav Codec Communication Pvt. Ltd.Swargate, Pune.Ph: 020-2422 1460/70 (Ext 37)Email: [EMAIL PROTECTED]

Re: [SQL] generating a sequence table against which to do a LEFT OUTER JOIN

2005-10-18 Thread David Fetter
Andrew Hammond <[EMAIL PROTECTED]> wrote: > So I need an end result that has entries for all days, even when > there's nothing happening on those days, generate from a timestamped > event table. I've already got the interesting entries. Now I need to > fill the holes. > > To do this, I'm thinking

[SQL] Query information needed

2005-10-18 Thread djzanky
Dear all, I have a table created with this specifications: CREATE TABLE cdr ( calldate timestamp with time zone NOT NULL default now(), clid varchar(80) NOT NULL default '', src varchar(80) NOT NULL default '', dst varchar(80) NOT NULL default '', dcontext varchar(80) NOT NULL default '

Re: [SQL] cast

2005-10-18 Thread Dan Feiveson
I believe int8(n.udf4) will do the trick for you. - Original Message - From: "Judith Altamirano Figueroa" <[EMAIL PROTECTED]> To: Sent: Friday, October 14, 2005 12:08 PM Subject: [SQL] cast > Hello I have a query that ran in 7.0.2, but in 8.0.1 does not, the query > is the next: > >

[SQL]

2005-10-18 Thread Shavonne Marietta Wijesinghe
how can i do a query with 2 databases??

[SQL] problems with array

2005-10-18 Thread paperinik 100
PostgreSQL is 7.4.7. My first table CREATE TABLE tb_cat ( id INTEGER, desc text ); INSERT INTO tb_cat VALUES (10, 'cat10'); INSERT INTO tb_cat VALUES (20, 'cat20'); INSERT INTO tb_cat VALUES (30, 'cat30'); My second table CREATE TABLE tb_array( id INTEGER, cat INTEGER[] ); INSERT INTO tb_array V

[SQL] Problem while using start transaction ans commit;

2005-10-18 Thread Sri
Hi All,   I have a small problem in using nested transactions while working on Postgres 8.0.   Ex: I have a function A() which in turn calls functions b() and c() , if i want commit something in b or c. i have to use   start transaction read write; -- set of sql statements and then say com

[SQL] What Am I Doing Wrong?

2005-10-18 Thread Lane Van Ingen
I have been trying to subtract two timestamps from each other to determine the difference between the two timestamps (current time and a past timestamp called 'updated_time') IN SECONDS, but no luck. The trouble I am having is getting the first timestamp, representing the current time, to translat

Re: [SQL] What Am I Doing Wrong?

2005-10-18 Thread Lane Van Ingen
Ignore my request. The solution is: --- computeIfUptime() - select (EXTRACT(EPOCH from TIMESTAMP 'now') - EXTRACT(EPOCH from TIMESTAMP '2005-10-18 17:00:00'))::integer -Original Message- From: Lane Van Ingen [mailto:[EMAIL P

Re: [SQL] Consulta!

2005-10-18 Thread Mario Splivalo
On Tue, 2005-10-18 at 14:26 +, Adriana Marcela Aguirre wrote: > Hola a todos!!... Hi! :) That's a known postges 'problem', one which, I guess, every pg-newbie encounters, especialy if he/she came from other RDBMSes. (I personaly came from MSSQL). > CREATE OR REPLACE FUNCTION "public"."f_test

[SQL] Consulta!

2005-10-18 Thread Adriana Marcela Aguirre
Hola a todos!!... El día 22-07-2004 Gerardo Castillo escribió lo siguiente:   / Hello,   I'm using PostgreSQL 7.4   I have a function wich use temporary tables. I read about temporary tables and they exists during the session. But i have to call this f