Re: [SQL] Adding "on delete cascade" to all foreign key constraints

2007-05-15 Thread Jim C. Nasby
On Tue, May 15, 2007 at 12:19:54PM -0500, Peter Hanson wrote: > Hello, > > I was wondering if there's a fast way I can add "on delete cascade" to all > foreign key constraints in my database? Maybe a quick update I can make > against the catalog possibly? Or is there a way I can query for all f

Re: [SQL] SQL Query Validate Records Multiple Tables - Help Needed

2007-05-15 Thread Rodrigo De León
On May 15, 8:17 am, Paul251 <[EMAIL PROTECTED]> wrote: > Hello... > > I am trying to validate a asset number (10 Characters) from one table > to another table. Problem is they are in two different DB's and > haven't done that before? > > Basically trying to take record 1 from Table 1/DB1 and valida

[SQL] Adding "on delete cascade" to all foreign key constraints

2007-05-15 Thread Peter Hanson
Hello, I was wondering if there's a fast way I can add "on delete cascade" to all foreign key constraints in my database? Maybe a quick update I can make against the catalog possibly? Or is there a way I can query for all foreign key constrains in the database and then I could write up a quick

Re: [SQL] workday function

2007-05-15 Thread Gary Stainburn
On Tuesday 15 May 2007 10:17, Richard Huxton wrote: > Kenneth Gonsalves wrote: > > On 15-May-07, at 2:39 PM, Richard Huxton wrote: > >> Don't know of one - not sure what "workday" would mean in a global > >> sense. I mean, Mon-Fri in most European office settings, but you'd > >> include Sat in reta

Re: [SQL] Serial number of a record

2007-05-15 Thread Andrew Sullivan
On Tue, May 15, 2007 at 07:40:25AM -0400, [EMAIL PROTECTED] wrote: > Suppose if i will fire a query "select Name from tablename where age=30". > it will give output "shyam" but i also want record no. other then oid, in > this case it is 3. > > is it possible? > if yes then how? > plz. help me. Th

[SQL] Serial number of a record

2007-05-15 Thread [EMAIL PROTECTED]
Hi List, I have one table something like this Name Age = tom 20 ram 25 shyam 30 balram15 hari 10 Now i want serial number of a record. Suppose if i will fire a query "select Name from tablename where age=30". it will give outp

Re: [SQL] workday function

2007-05-15 Thread Pavel Stehule
Hello You can use functions from Orafce package http://www.pgsql.cz/index.php/Oracle_functionality_%28en%29#PLVdate sample: SELECT plvdate.plvdate.default_holydays('czech'); SELECT plvdate.add_bizdays(CURRENT_DATE, 10); SELECT plvdate.isbizday('2006-12-25'); Regards Pavel Stehule 2007/5/15,

Re: [SQL] pg_dump?

2007-05-15 Thread Andrew Sullivan
You want to look at the pg_dump command. A On Mon, May 14, 2007 at 03:48:17PM -0700, Richard Dunne wrote: > PostgreSQL begginer. Whats the best way of exporting(dumping) a > database/table/view/query to a file? > I am using PostgreSQL v 8.2. I am starting postgres server with > C:\WINDOWS\sys

Re: [SQL] workday function

2007-05-15 Thread Reinoud van Leeuwen
On Tue, May 15, 2007 at 09:51:34AM +0100, Gary Stainburn wrote: > Hi folks > > I need to be able to add and subtract workdays, something like > > select CURRENT_DATE - '3 work days'::interval; Would that take holidays into account? (and wich ones?) -- __

Re: [SQL] workday function

2007-05-15 Thread Dave Page
Kenneth Gonsalves wrote: > > On 15-May-07, at 2:39 PM, Richard Huxton wrote: > >> Don't know of one - not sure what "workday" would mean in a global >> sense. I mean, Mon-Fri in most European office settings, but you'd >> include Sat in retail settings and in Islamic countries presumably >> exclu

Re: [SQL] workday function

2007-05-15 Thread Kenneth Gonsalves
On 15-May-07, at 2:39 PM, Richard Huxton wrote: Don't know of one - not sure what "workday" would mean in a global sense. I mean, Mon-Fri in most European office settings, but you'd include Sat in retail settings and in Islamic countries presumably exclude Fridays. Our local library shuts

Re: [SQL] workday function

2007-05-15 Thread Richard Huxton
Kenneth Gonsalves wrote: On 15-May-07, at 2:39 PM, Richard Huxton wrote: Don't know of one - not sure what "workday" would mean in a global sense. I mean, Mon-Fri in most European office settings, but you'd include Sat in retail settings and in Islamic countries presumably exclude Fridays. O

Re: [SQL] workday function

2007-05-15 Thread Richard Huxton
Gary Stainburn wrote: Hi folks I need to be able to add and subtract workdays, something like select CURRENT_DATE - '3 work days'::interval; I can't see how to do this natively so I'm looking to write a function to do it and was wondering if anyone's already done it. Don't know of one - not

[SQL] workday function

2007-05-15 Thread Gary Stainburn
Hi folks I need to be able to add and subtract workdays, something like select CURRENT_DATE - '3 work days'::interval; I can't see how to do this natively so I'm looking to write a function to do it and was wondering if anyone's already done it. While Googling I've found that MS Excel has a wo

Re: [SQL] How to process inverted comma in "EXECUTE 'insert into xxx values(...)

2007-05-15 Thread Nemo Terry
quote_literal() works.Thanks a lot! From: Richard Huxton <[EMAIL PROTECTED]> To: Nemo Terry <[EMAIL PROTECTED]> CC: pgsql-sql@postgresql.org Subject: Re: [SQL] How to process inverted comma in "EXECUTE 'insert into xxx values(...) Date: Tue, 15 May 2007 08:12:55 +0100 Nemo Terry wrote: > But

Re: [SQL] How to process inverted comma in "EXECUTE 'insert into xxx values(...)

2007-05-15 Thread Rodrigo De León
On 5/15/07, Nemo Terry <[EMAIL PROTECTED]> wrote: But I must use it in function,so... Do you have another solution? So? t=# CREATE TABLE d(i INT); CREATE TABLE t=# CREATE OR REPLACE FUNCTION add1(x INT) RETURNS INT AS t-# $$ t$# BEGIN t$# INSERT INTO

Re: [SQL] How to process inverted comma in "EXECUTE 'insert into xxx values(...)

2007-05-15 Thread Richard Huxton
Nemo Terry wrote: > But I must use it in function,so... > Do you have another solution? >>> because obj_name from another table has value like this:S'pore High >>> Polymer. >>> Following error raises: >>> ERROR: syntax error at or near "pore" You'll want to look into the quote_ident() and quote_