[SQL] converting microsoft sql server 2000 sql-code for postgresql 7.2.1

2003-01-28 Thread william windels
Hello all, I a m a new member of the list and at the moment , I am studiing informatica: sql. At the workplace, we use microsoft sql server 2000. At home, I use postgresql 7.2.1 and now I would import the data of the database at the workplace into the postgresql environment at home. I have paste

Re: [SQL] converting microsoft sql server 2000 sql-code for postgresql

2003-01-28 Thread Bhuvan A
> Can someone tell me how I can adjust the syntax of the code and in global: > how can I convert sql-code , for microsoft sql server 2000, to sql-code for > postgresql? > Try, http://techdocs.postgresql.org/techdocs/sqlserver2pgsql.php regards, bhuvaneswaran ---(end of

[SQL] subselect return in where clause

2003-01-28 Thread Michael Hostbaek
Group, Is it possible to use a subselect result in a where statement ? If so, how ? Fx. select some_stuff, more_stuff, (select other_stuff from other_table where other_table.stuff ilike stuff.match) as other_stuff from stuff where other_stuff = 'hello' thanks. -- Best Regards, Michael

Re: [SQL] converting microsoft sql server 2000 sql-code for postgresql 7.2.1

2003-01-28 Thread Geraint Jones
On Tuesday 28 January 2003 10:08 am, william windels wrote: A lot of SQL! Instead of spending a lot of time trying to figure out what's wrong with your code, here's a couple of links that should help you: The most obvious is the PostgreSQL documentation which can be found in the doc directory of

Re: [SQL] converting microsoft sql server 2000 sql-code for postgresql 7.2.1

2003-01-28 Thread Rajesh Kumar Mallah.
Only 1 small change makes it acceptable to pgsql. change datetime to timestamp . regds mallah. On Tuesday 28 January 2003 03:38 pm, william windels wrote: > Hello all, > > I a m a new member of the list and at the moment , I am studiing > informatica: sql. > > At the workplace, we use microsof

[SQL] import error

2003-01-28 Thread Oliver Vecernik
Hi all! I'm trying to import a text file from Suunto Dive Manager. I've got following table structure: CREATE TABLE dives ( id int, dive_number int, dive_date date, time_of_day time, series int, dc_dive_number int, dive_time int, surface_interval int, max_depth float, mean_depth float, dc_type i

Re: [SQL] import error

2003-01-28 Thread Achilleus Mantzios
On Tue, 28 Jan 2003, Oliver Vecernik wrote: > > 1,1,"07.08.2001","11:35",1,1,2220,0,6.0,0.0,12,0,"",20,0,0,0,1,"Sarigerme","Asche > Bucht","wolkenlos",">20m",35,0,30,"","Mehmet > Semerkant","","",0.0,1,0.,0.,0,0.,0,"","","","","",12,0,0,0 Why dont you get rid of "'s ? e.g. 1,1

Re: [SQL] import error

2003-01-28 Thread Achilleus Mantzios
On Tue, 28 Jan 2003, Achilleus Mantzios wrote: > On Tue, 28 Jan 2003, Oliver Vecernik wrote: > > > > > 1,1,"07.08.2001","11:35",1,1,2220,0,6.0,0.0,12,0,"",20,0,0,0,1,"Sarigerme","Asche > > Bucht","wolkenlos",">20m",35,0,30,"","Mehmet > > Semerkant","","",0.0,1,0.,0.,0,0.,0,"","",""

Re: CR/LF conversion (was: [SQL] import error)

2003-01-28 Thread Oliver Vecernik
Oliver Vecernik schrieb: Hi all! I'm trying to import a text file from Suunto Dive Manager. I've got following table structure: Arghh ... It's always the same problem with CR/LF conversions ... After changing it to just LFs, everthing worked like a charm. Is there an elegant way to handle

Re: CR/LF conversion (was: [SQL] import error)

2003-01-28 Thread Achilleus Mantzios
On Tue, 28 Jan 2003, Oliver Vecernik wrote: > Oliver Vecernik schrieb: > > > Hi all! > > > > I'm trying to import a text file from Suunto Dive Manager. I've got > > following table structure: > > Arghh ... > > It's always the same problem with CR/LF conversions ... > > After changing it to just LF

[SQL] CSV import

2003-01-28 Thread Oliver Vecernik
Hi again! After investigating a little bit further my CSV import couldn't work because of following reasons: 1. CSV files are delimited with CR/LF 2. text fields are surrounded by double quotes Is there a direct way to import such files into PostgreSQL? I would like to have something like MySQ

Re: [SQL] CSV import

2003-01-28 Thread Achilleus Mantzios
On Tue, 28 Jan 2003, Oliver Vecernik wrote: > Hi again! > > After investigating a little bit further my CSV import couldn't work > because of following reasons: > > 1. CSV files are delimited with CR/LF See below > 2. text fields are surrounded by double quotes in vi :1,$ s/"//g > > Is there a

Re: [SQL] import error

2003-01-28 Thread Tom Lane
Oliver Vecernik <[EMAIL PROTECTED]> writes: > My import gives following error: > sport=# copy dives from '/var/n/tmp/ov.CSV' delimiters ','; > ": can't parse "ne 1, pg_atoi: error in "0 The weird formatting of the error message suggests that the problem is DOS-style newlines (CR/LF). COPY only l

Re: CR/LF conversion (was: [SQL] import error)

2003-01-28 Thread Tom Lane
Oliver Vecernik <[EMAIL PROTECTED]> writes: > It's always the same problem with CR/LF conversions ... Ah, you figured it out. (Didn't see your followup right away because of the changed subject line.) > After changing it to just LFs, everthing worked like a charm. Is there > an elegant way to h

Re: [SQL] subselect return in where clause

2003-01-28 Thread Tom Lane
Michael Hostbaek <[EMAIL PROTECTED]> writes: > select some_stuff, more_stuff, > (select other_stuff from other_table where other_table.stuff ilike > stuff.match) as other_stuff from stuff where other_stuff = 'hello' The above is nonsensical: WHERE cannot refer to values computed in the SELECT lis

[SQL] Cross-database references

2003-01-28 Thread Pedro Igor Craveiro e Silva
Title: AIP - Assessoria Informática e Proteção LTDA Someone knows how is going the implementation of cross database references in pgsql ? Would have some future release with this great functionality ?   Thanks,   Pedro Igor

[SQL] Problem with query

2003-01-28 Thread Ricardo Javier Aranibar León
Hi, I don't know what happend when I execute this query? select * from llamada where fecha='20030127' and tipo=1 and tiempo>0 and gwdes like '64.7.127.14%' order by hora desc; It's very slow, it takes approximately 6 minutes to show me the results. I saw that it's happend when I execute this t

Re: [SQL] CSV import

2003-01-28 Thread Guy Fraser
Hi You will need two text utilities {dos2unix and sed} to do this in the simplest way. They are fairly standard text utilities and are probably already on your machine. This is how I would do it : sed "s/\"//g" file_name.txt \ | dos2unix \ | pgsql -c "COPY table_name FROM STDIN USING DELIMIT

Re: [SQL] converting microsoft sql server 2000 sql-code for postgresql

2003-01-28 Thread Guy Fraser
Hi You should use "date" instead of "datetime" since the data is only a date and a "date" type uses less storage than a "timestamp". For time only data use type "time" or "timetz" if you want the timezone as well. For data with a date and time use "timestamp" or "timestamptz" if you want to in

Re: [SQL] CSV import

2003-01-28 Thread Jeff Eckermann
--- Oliver Vecernik <[EMAIL PROTECTED]> wrote: > Is there a direct way to import such files into > PostgreSQL? > As I believe others have replied: no, not yet. If you are absolutely sure that your data will _never_ contain commas, then the simple solution of just deleting all of the quotes , the

Re: [SQL] converting microsoft sql server 2000 sql-code for postgresql 7.2.1

2003-01-28 Thread Jeff Eckermann
--- william windels <[EMAIL PROTECTED]> wrote: > how can I convert sql-code , for microsoft sql > server 2000, to sql-code for > postgresql? > In addition to the suggestions given in other replies, have a look at PGAdminII: http://pgadmin.postgresql.org That is an excellent utility, and comes wit

Re: [SQL] Cross-database references

2003-01-28 Thread Jason Turner
On Tue, Jan 28, 2003 at 05:30:06PM -0200, Pedro Igor Craveiro e Silva wrote: > AIP - Assessoria Informática e Proteção LTDASomeone knows how is going the >implementation of cross database references in pgsql ? > Would have some future release with this great functionality ? This is usually left u

[SQL] LONG - Question on dealing w/ numerics

2003-01-28 Thread David Durst
I have a function that is to create a Accounting JOURNAL entry. The strange thing is the function works for simple entries such as: Cash - Debit 100 A/R - Credit 100 But when I try to trick it or break it for testing purposes (IT DOES BREAK WHEN IT SHOULDN'T) on a entry like this: Cash - Debit

Re: [SQL] Cross-database references

2003-01-28 Thread Roberto Mello
On Tue, Jan 28, 2003 at 05:30:06PM -0200, Pedro Igor Craveiro e Silva wrote: > AIP - Assessoria Informática e Proteção LTDASomeone knows how is going the >implementation of cross database references in pgsql ? > Would have some future release with this great functionality ? Olá Pedro, Look at th

Re: [SQL] converting microsoft sql server 2000 sql-code for postgresql

2003-01-28 Thread Tom Lane
Guy Fraser <[EMAIL PROTECTED]> writes: > If you go through the documentation you can also find out how to CREATE your > own data TYPE to allow more direct use of non-PostgreSQL data types. Here is > an example that will allow input of any "datetime" data into PostgreSQL : > CREATE TYPE datetime

Re: [SQL] CSV import

2003-01-28 Thread Jean-Luc Lachance
You can acheive the same result with: tr -d '"\015' < file_name.txt | psql {etc...} Unix EOL is LF not CR. Guy Fraser wrote: > > Hi > > You will need two text utilities {dos2unix and sed} to do this in the simplest > way. They are fairly standard text utilities and are probably already on you

Re: [SQL] Problem with query

2003-01-28 Thread Tom Lane
=?iso-8859-1?B?UmljYXJkbyBKYXZpZXIgQXJhbmliYXIgTGXzbg==?= <[EMAIL PROTECTED]> writes: > I used PostgreSQL 7.0.3 Please consider upgrading to something more recent. 7.0 predates a lot of work we've done on query optimization ... regards, tom lane ---

Re: [SQL] Problem with query

2003-01-28 Thread Josh Berkus
Ricardo, For future notice, there is another mailing list, PGSQL-PERFORMANCE, devoted to questions like yours. > select * from llamada where fecha='20030127' and tipo=1 and tiempo>0 > and gwdes like '64.7.127.14%' order by hora desc; > > It's very slow, it takes approximately 6 minutes to show m

Re: [SQL] LONG - Question on dealing w/ numerics

2003-01-28 Thread Josh Berkus
David, > I have a function that is to create a Accounting JOURNAL entry. > The strange thing is the function works for simple entries such as: > Here is the function and I can't seem to figure out what is LOGICALLY > wrong and would produce these results. I'm not sure the problem is with the fun

Re: [SQL] LONG - Question on dealing w/ numerics

2003-01-28 Thread Josh Berkus
David, > Cash - Debit 100 > A/R - Credit 100 > Cash - Credit 100 > A/R - Debit 100 > (Which should have a net affect of 0 on both accounts) > > But here is the resulting balance on accounts, > > Cash Debit Balance 200 > A/R Credit Balance 200 Here may your problem, and it's in the schema

Re: [SQL] CSV import

2003-01-28 Thread Rodger Donaldson
> --- Oliver Vecernik <[EMAIL PROTECTED]> wrote: > > Is there a direct way to import such files into > > PostgreSQL? > > > > As I believe others have replied: no, not yet. > > Otherwise, parsing CSV > files gets just too complicated, and you are better > off using an existing solution (like a Pe

Re: [SQL] LONG - Question on dealing w/ numerics

2003-01-28 Thread Tom Lane
"David Durst" <[EMAIL PROTECTED]> writes: > insert into journal_lines (entry_id,account_id,line_type,line_amount) > values (eid,aid,ltype,amount); > select into line * from journal_lines where entry_id = eid AND > account_id = aid AND ltype = ltype; I bet that last should be line_type = ltype?

[SQL] checking data integrity in a recursive table

2003-01-28 Thread Luke Pascoe
Hi, I have a table that references itself to create a tree-like structure, eg: CREATE TABLE tree ( id SERIAL NOT NULL, name VARCHAR(255) NOT NULL, parent INT NULL, customer IN NOT NULL, CONSTRAINT parent_key... CONSTRAINT customer_fk FOREIGN

Re: [SQL] double linked list

2003-01-28 Thread --CELKO--
>> I've got a table called 'link_t' containing a collection of seller - buyer relations between two parties. << That is not a real linked list, but let's ignore bad terminology. One way to do this is with cursors, but they will take time and trend to be proprietary. Anohter way is to build a tre

[SQL] Cross-table constraints

2003-01-28 Thread Rodger Donaldson
The problem: I have two tables, add_queue and sites, on a postgresql 7.2.x database. add_queue is where items go to be reviewed by a human before being moved into sites. One of the things I'd like to do is to cut down on the amount of work done by humans filtering out dupes and sundry other prob

[SQL] double linked list

2003-01-28 Thread Juergen
Hi folks!, I've got a table called 'link_t' containing a collection of seller - buyer relations between two parties. sql> select * from link_t S B - - C X A B B C C D D E 5 rows selected. I am looking for a select statement that returns the concatenation of seller - buyer relations between the

[SQL] Filter function

2003-01-28 Thread Evgen Potemkin
Hello there! is there any way to create filter function? i.e. function which will be accepting and returning row sets, like select foo(t) from (select blah from tab) t; something like this. contrib/tablefunc seems not accepting a row set. also, not related to above, i've typed query: term2=>se

Re: [SQL] Scheduling Events?

2003-01-28 Thread Ed L.
On Thursday January 23 2003 5:16, David Durst wrote: > Is there anyway to schedule DB Events based on time? If you're using one of the unices (linux, etc.), how about... crontab + perl + DBI + DBD::Pg? or crontab + bash/sh + psql + pl/pgsql? ---(end of broadcast)--

Re: [SQL] converting microsoft sql server 2000 sql-code for postgresql

2003-01-28 Thread Wei Weng
What about a UNIQUEIDENTIFIER type? Is the only way casting it to a CHAR(38)? (Create a domain for it) And does the performance suffer if I do the Domain/create my own data type tricks? Thanks! Wei - Original Message - From: "Tom Lane" <[EMAIL PROTECTED]> To: "Guy Fraser" <[EMAIL PRO

Re: [SQL] double linked list

2003-01-28 Thread DA Morgan
Juergen wrote: > Hi folks!, > > I've got a table called 'link_t' containing a collection of seller - > buyer relations between two parties. > > sql> select * from link_t > > S B > - - > C X > A B > B C > C D > D E > > 5 rows selected. > > I am looking for a select statement that returns the concat

Re: [SQL] Rename database?

2003-01-28 Thread codeWarrior
No. Try instead CREATE DATABASE newname FROM TEMPLATE oldname; DROP DATABASE oldname; ""Wei Weng"" <[EMAIL PROTECTED]> wrote in message 000c01c2c32b$09526500$5301a8c0@monet">news:000c01c2c32b$09526500$5301a8c0@monet... > This is a multi-part message in MIME format. > > --=_NextPart_000_0009

Re: [SQL] SQL to list databases?

2003-01-28 Thread Horst Herb
On Fri, 24 Jan 2003 05:56, you wrote: > Is there a query that will return all the databases available, similar > to what psql -l does? select * from pg_database; Horst ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster

[SQL] Creating tables from within functions

2003-01-28 Thread Seethalakshmi VB
Is it possible to issue a CREATE TABLE statement from inside of a PostgreSQL function? If not, then how about from within a PL/pgSQL function? I have tried a lot of different permutations but can't seem to get it to compile and/or run cleanly. For example, consider: CREATE FUNCTION _tes

Re: [SQL] CSV import

2003-01-28 Thread Oliver Vecernik
Oliver Vecernik schrieb: Hi again! After investigating a little bit further my CSV import couldn't work because of following reasons: 1. CSV files are delimited with CR/LF 2. text fields are surrounded by double quotes Is there a direct way to import such files into PostgreSQL? The answer s

Re: [SQL] Cross-table constraints

2003-01-28 Thread Stephan Szabo
On Tue, 28 Jan 2003, Rodger Donaldson wrote: > Now, adding a UNIQUE constraint on the pk for add_queue weeds out > dupes there. However, attempting to add a cross-table UNIQUE check > with: > > alter table add_queue add constraint add_queue_no_dupe_sites unique > (sites.url); > ERROR: parser: p

Re: [SQL] Cross-table constraints

2003-01-28 Thread Stephan Szabo
On Wed, 29 Jan 2003, Rodger Donaldson wrote: > > On Tue, 28 Jan 2003, Rodger Donaldson wrote: > > > > > Now, adding a UNIQUE constraint on the pk for add_queue weeds out > > > dupes there. However, attempting to add a cross-table UNIQUE check > > > with: > > > > > > alter table add_queue add con

[SQL] Please include hier-patch in next PostgreSQL version

2003-01-28 Thread Boris Klug
Hello! I want to say that it would be fantastic when you include the Oracle like "CONNECT BY" patch (see gppl.terminal.ru/readme.html) in the next version of PostgreSQL. It is very usefull for people that have to handle such kind of hierarchical data. -- Dipl. Inform. Boris Klug, control IT G