Re: [SQL] Plz, what is the most "correct" method
On Wednesday 10 September 2003 17:01, PipHans wrote: > Table1: > idAuto,int,PrimKey > table2idint > txt nvarchar50 > > Table2: > idAuto,int,PrimKey > order int > > The scenario: Table2.order defines how the table1.txt is should be ordered. > Table1.table2id contains the id of the order. This cannot be changed > > How do I select all Table1.txt values but ordered by their corresponding > values of the table2.order field? Sorry for the delay here - are you subscribed to the list? If not that can slow things down (it only showed Monday, after you posted Wednesday). All you need to do is join the two tables and order by the required field SELECT t1.id, t1.txt FROM table1 as t1, table2 as t2 WHERE t1.table2id=t2.id ORDER BY t2.order -- Richard Huxton Archonet Ltd ---(end of broadcast)--- TIP 9: the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match
[SQL] Copy Command Error
I am outputting the following rows from a SYBASE database on W2000 3 '2' 'IBISFinancials' 'A.C.N. 072 378 815'8 'RK' 'Personal Accounts' Using the command: select cast(seq as integer) , id , cmpy, tr_n from fcont; output to d:\fcont.dat format 'ascii' delimited by '\x09' This outputs the fields tab delimited and with strings encased in inverted commas I then use the followin POSTRESQL command: copy fcont (seq,id,cmpy,tr_n) from 'd:\\fcont.dat' The problem is that each string is imported with the inverted commas. eg field ID = ''RK'' instead of 'RK' Can someone please help? thanks Richard
Re: [SQL] Copy Command Error
On Monday 15 September 2003 09:57, Richard Sydney-Smith wrote: > I am outputting the following rows from a SYBASE database on W2000 > The problem is that each string is imported with the inverted commas. > > eg field ID = ''RK'' instead of 'RK' > > Can someone please help? A short bit of perl. Something like (untested) perl -pi -e 's/\t"/\t/g' fcont.dat perl -pi -e 's/"\t/\t/g' fcont.dat That should pre-process the file. I'm sure someone else on the list will show how to do it in sed. Hmm - just noticed you are on Windows. Not sure what cygwin ships with, or whether you have perl installed. -- Richard Huxton Archonet Ltd ---(end of broadcast)--- TIP 9: the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match
Re: [SQL] change a field
On Wed, Sep 10, 2003 at 22:12:45 +0200, Patrick Meylemans <[EMAIL PROTECTED]> wrote: > > What is the best way to solve this problem ? The best way is probably with a view. ---(end of broadcast)--- TIP 7: don't forget to increase your free space map settings
[SQL] SET database TO ...?
Hi, Suppose, one server/postmaster is running several databases. Is there something like "SET database TO whatever" (and I mean *database* not schema). I need this to ensure that a script runs only against db for which it was desinged. Thanks __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com ---(end of broadcast)--- TIP 7: don't forget to increase your free space map settings
Re: [SQL] SET database TO ...?
On Mon, 15 Sep 2003, ow wrote: > Hi, > > Suppose, one server/postmaster is running several databases. Is there something > like "SET database TO whatever" (and I mean *database* not schema). I need this > to ensure that a script runs only against db for which it was desinged. [EMAIL PROTECTED] ~]% psql Welcome to psql 7.3.4, the PostgreSQL interactive terminal. Type: \copyright for distribution terms \h for help with SQL commands \? for help on internal slash commands \g or terminate with semicolon to execute query \q to quit dynacom=# \c bab You are now connected to database bab. bab=# bab=# bab=# \c dynacom You are now connected to database dynacom. dynacom=# \q [EMAIL PROTECTED] ~]% > > Thanks > > > > > > > > __ > Do you Yahoo!? > Yahoo! SiteBuilder - Free, easy-to-use web site design software > http://sitebuilder.yahoo.com > > ---(end of broadcast)--- > TIP 7: don't forget to increase your free space map settings > -- == Achilleus Mantzios S/W Engineer IT dept Dynacom Tankers Mngmt Nikis 4, Glyfada Athens 16610 Greece tel:+30-210-8981112 fax:+30-210-8981877 email: achill at matrix dot gatewaynet dot com mantzios at softlab dot ece dot ntua dot gr ---(end of broadcast)--- TIP 8: explain analyze is your friend
Re: [SQL] SET database TO ...?
> Suppose, one server/postmaster is running several databases. Is there > something like "SET database TO whatever" (and I mean *database* not > schema). I need this to ensure that a script runs only against db for > which it was desinged. You can use PG* environment variables if you wish to write seperate script for each databases. regards, bhuvaneswaran ---(end of broadcast)--- TIP 9: the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match
Re: [SQL] SET database TO ...?
--- Achilleus Mantzios <[EMAIL PROTECTED]> wrote: [...] > dynacom=# \c bab > You are now connected to database bab. > bab=# I'm actually looking for a way to set database from a *script*, not psql console, if this is possible (similar to "SET search_path TO whatever;"). Any ideas? Thanks __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://archives.postgresql.org
Re: [SQL] SET database TO ...?
ow <[EMAIL PROTECTED]> writes: > --- Achilleus Mantzios <[EMAIL PROTECTED]> wrote: >> dynacom=# \c bab >> You are now connected to database bab. > I'm actually looking for a way to set database from a *script*, not psql > console, if this is possible (similar to "SET search_path TO whatever;"). If the script is being fed to psql, it can use \c ... regards, tom lane ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]
