Re: [SQL] sql programming

2000-08-15 Thread Prasanth A. Kumar
"Michael Wagner" <[EMAIL PROTECTED]> writes: > We need to export an SQL database to Excel. Is this within your scope and = > what might your cost be? > > Please respond to Dan Beach Why not just save it to text CSV format and Excel can then easily import it. -- Prasanth Kumar [EMAIL PROTECT

Re: [SQL] sql programming

2000-08-15 Thread Webb Sprague
Make it text, then import it. You will have lots of tables. Send the check to :) --- Michael Wagner <[EMAIL PROTECTED]> wrote: > We need to export an SQL database to Excel. Is this > within your scope and what might your cost be? > > Please respond to Dan Beach > > [EMAIL PROTECTED] >

Re: [SQL] copy from

2000-08-15 Thread Stephan Szabo
On Tue, 15 Aug 2000, Adam Lang wrote: > Gotcha. Now, if I do an insert and just don't specify that field at all, it > will, use the default value, correct? As long as I don't "touch" the field > with anything it uses the default. Right, as long as you don't specify the field in the column lis

[SQL] sql programming

2000-08-15 Thread Michael Wagner
We need to export an SQL database to Excel.  Is this within your scope and what might your cost be?   Please respond to Dan Beach   [EMAIL PROTECTED]

Re: [SQL] Use a rule or a transaction

2000-08-15 Thread Antoine Reid
On Tue, Aug 15, 2000 at 02:52:24PM -0400, Madel, Kurt wrote: > Hello Antoine, > > I thought that triggers only worked for one table at a time. In this case, > I want the class.size incremented and checked for maxsize when I perform an > update or insert on the module table. I was under the impr

Re: [SQL] Use a rule or a transaction

2000-08-15 Thread Antoine Reid
On Tue, Aug 15, 2000 at 01:57:17PM -0400, Madel, Kurt wrote: > Hello, > > I am creating a web based (using php) class registration database with three > tables directly effected by the registration process: [snip] > My question is, would it be better (faster) to use rules or to use a > transact

Re: [SQL] Functions with Null Arguments?

2000-08-15 Thread Thomas Swan
At 01:24 PM 8/15/2000, DalTech - CTE wrote: Known bug in some versions.  I believe it was fixed in v7.x, though.   Cheers - Original Message - From: Thomas Swan To: DalTech - CTE ; Thomas Swan Cc: Pgsql-sql Sent: Tuesday, August 15, 2000 1:43 PM Subject: Re: [SQL] Functions with N

Re: [SQL] Use a rule or a transaction

2000-08-15 Thread Antoine Reid
On Tue, Aug 15, 2000 at 03:38:09PM -0400, Madel, Kurt wrote: > Hey Antoine, > > I am using 7.0.2, and I would be in your debt if you created a working > example. Basically, the structure of the query I would like to do is as > such (there are six modules in the module table for each quarter: > a

[SQL] Re: Copwatch database

2000-08-15 Thread Qiron Adhikary
[EMAIL PROTECTED] wrote: > > Our non-profit organization needs a skilled volunteer to create a > searchable database of abusive cops. Any SQL-type database program is > OK- others may be suitable also. We've already compiled the > questions/outline around which the database inputs will be struc

Re: [SQL] PL/PGSQL Function problem.

2000-08-15 Thread Stephan Szabo
Actually, you can't do too much about it in PL/PGSQL, because IIRC there isn't a way right now to do that. I don't remember when PL/TCL came into existance (don't know TCL), but you'd be able to do it in that, and you can also do it from SPI in a C function. And finally, the obligatory upgrade

Re: [SQL] copy from

2000-08-15 Thread Stephan Szabo
Sort of. You can give the field a default value of nextval() which means that if you do not specify the column in an insert, it automatically gets the default value which should be the next value in the sequence. Note, that not putting the column is different from inserting a NULL into the field

Re: [SQL] My Indices doesn't work

2000-08-15 Thread Stephan Szabo
First, make sure you ran vacuum analyze to update the statistics for the table. If a large portion of your table is going to be scanned, Seq Scan is often faster than Index Scan due to possibly random seeks within the heap file (the transaction commit state isn't in the index, so there is still

Re: [SQL] Functions with Null Arguments?

2000-08-15 Thread Thomas Swan
At 10:12 AM 8/15/2000, DalTech - CTE wrote: I would try using COALESCE(list) which will return the first non-NULL in the list. That worked! Thanks! The second part is why does postgresql not evaluate the function if one of the arguments is null?

Re: [SQL] copy from

2000-08-15 Thread Stephan Szabo
Well, if you define your main table to have a serial, or an explicit default nextval(seqid), you won't even need to do that. Just leave the column off the insert list and the default should fill it for you. Stephan Szabo [EMAIL PROTECTED] On Tue, 15 Aug 2000, Adam Lang wrote: > I get it. I up

RE: [SQL] Use a rule or a transaction

2000-08-15 Thread Jesus Aneiros
Create a trigger on module before update or insert. The philosophy of postgres is to create a trigger based on a function previously created. Take a look at the docs, the part on procedural languages. The book from Momjian has one or two examples on triggers creation. -- Jesus Aneiros Sosa mailt

[SQL] Accessing field properties

2000-08-15 Thread Campbell, Scott
Hey, Is there a way to access the properties of a field through an SQL statement? i.e. wether field is a foreign key or if it is primary or varchar etc. I am connecting to the database through PERL/DBI and need to access the properties of the fields to build the web page around. Thanks Scott

RE: [SQL] Use a rule or a transaction

2000-08-15 Thread Madel, Kurt
Hey Antoine, That is awesome, you just whipped that out, and I think it will work beautifully. I will let you know. Also, I think I have the last one licked - The trigger on INSERT on modules should return an error if the class_id does not exist.. I created the 'module.class_id' as a foreign k

Re: [SQL] % escape

2000-08-15 Thread Jesus Aneiros
To escape % use \\% as in '50\\%', to escape ' use '' as in 'o''conell', retrieves o'conell Regards. -- Jesus Aneiros Sosa mailto:[EMAIL PROTECTED] http://jagua.cfg.sld.cu/~aneiros On Tue, 15 Aug 2000, Jie Liang wrote: > Hi,there, > > Is anybody know how I can escape % or ' (my column contai

Re: [SQL] Functions with Null Arguments?

2000-08-15 Thread Jesus Aneiros
I think you could use a function like the one below and use the following select: select id, name1, name2, prefname(foo) as pref from foo; create function prefname(foo) returns text as' declare foo alias for $1; begin if foo.name2 is null then return foo.na

RE: [SQL] Use a rule or a transaction

2000-08-15 Thread Madel, Kurt
Hey Antoine, I am using 7.0.2, and I would be in your debt if you created a working example. Basically, the structure of the query I would like to do is as such (there are six modules in the module table for each quarter: a_q1,b_q1,c_q1,d_q1,e_q1,morn_q1,a_q2.). A student comes to register

[SQL] % escape

2000-08-15 Thread Jie Liang
Hi,there, Is anybody know how I can escape % or ' (my column contains % or ' ) in my text field. select mystring from textbook where mystring like . -- Jie LIANG Internet Products Inc. 10350 Science Center Drive Suite 100, San Diego, CA 92121 Office:(858)320-4873 [EMAIL PROTECTED] www.

RE: [SQL] Use a rule or a transaction

2000-08-15 Thread Madel, Kurt
Hello Antoine, I thought that triggers only worked for one table at a time. In this case, I want the class.size incremented and checked for maxsize when I perform an update or insert on the module table. I was under the impression that a trigger would only work if I was performing an insert or

Re: [SQL] copy from

2000-08-15 Thread Adam Lang
Gotcha. Now, if I do an insert and just don't specify that field at all, it will, use the default value, correct? As long as I don't "touch" the field with anything it uses the default. Adam Lang Systems Engineer Rutgers Casualty Insurance Company - Original Message - From: "Stephan Szab

Re: [SQL] 8K Limit, whats the best strategy?

2000-08-15 Thread Poul L. Christiansen
I've just split the text up (in 8 pieces), so it fits into 8K rows. But thats only a viable solution if your text is less than a couple of 100K's. You could try to be a daredevil and use the Toast code, even if it's beta. But I don't know how far the Toast project has come. Keith Wong wrote: >

[SQL] Use a rule or a transaction

2000-08-15 Thread Madel, Kurt
Hello, I am creating a web based (using php) class registration database with three tables directly effected by the registration process: 1) class 2) student 3) module The module table has a field for every module (or class period) for every student that registers for a given year. When a stud

[SQL] PL/PGSQL Function problem.

2000-08-15 Thread Dirk Elmendorf
RedHat 6.2 /Postgres 6.53 I'm still very new at PL/PGSQL but I have looked thru all the documentation I could find before sending this in. I have a function that I would like to be able to apply to multiple tables without having to duplicate the code. I would like to be able to pass in the ta

[SQL] PL/pgSQL

2000-08-15 Thread Jie Liang
Hi, Is anybody know how to declare a explicit cursor in PL/pgSQL (not in SQL) ??? syntax: declare cursor mycur is select statement ?? it won't work! -- Jie LIANG Internet Products Inc. 10350 Science Center Drive Suite 100, San Diego, CA 92121 Office:(858)320-4873 [EMAIL PROTECTED] www.ipinc.c

Re: [SQL] copy from

2000-08-15 Thread Adam Lang
Hmmm... well, I don't think I have an "explicit" nextval. I created the table and then I did a create sequence broker_id; Are you implying that I can set the field to automatically create a nextval? Adam Lang Systems Engineer Rutgers Casualty Insurance Company - Original Message - From:

Re: [SQL] 8K Limit, whats the best strategy?

2000-08-15 Thread Adam Lang
I believe you are correct. Version 7.1 will supposedly eliminate the row size. Adam Lang Systems Engineer Rutgers Casualty Insurance Company - Original Message - From: "Thomas Swan" <[EMAIL PROTECTED]> To: "Keith Wong" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Tuesday, August 15, 20

Re: [SQL] 8K Limit, whats the best strategy?

2000-08-15 Thread Thomas Swan
At 06:29 AM 8/15/2000, Keith Wong wrote: Hi everyone, Just wondering what strategies people have used to get around the 8K row limit in Postgres. If anyone has been troubled by this limitation before and has a nice solution around it, I would love to hear it. My application is a web-based system

[SQL] ERROR: unexpected SELECT query in exec_stmt_execsql()

2000-08-15 Thread Branden R. Williams
Hi. I am attempting to create a function to do some selects and return some information. Pretty straight forward. No matter what I do, I always get this error. Here is my stored function and how I am calling it... create function sp_list_categories(int4) returns varchar as ' DECLARE p

Re[2]: [SQL] data integrity

2000-08-15 Thread Sandis
Hello Jesus, Tuesday, August 15, 2000, 4:04:40 PM, you wrote: JA> The solution is called referential integrity. you should use the foreign JA> key and references clause with cascade. >> can someone suggest some good online resource where such common sql topics >> discussed? JA> I would like to

Re: [SQL] Language dependent fields

2000-08-15 Thread Volker Krebs
Hi, thanks, that works ok. But has anybody some suggestions how this behaves performance wise, if I have like 10 language dependent fields and translation t1 till translation t10. Volker Renato De Giovanni wrote: > > Maybe something like this: > > CREATE VIEW locale_customer2 AS > SELECT cust

Re: [SQL] data integrity

2000-08-15 Thread Jesus Aneiros
On Tue, 15 Aug 2000, Sandis wrote: > there is a db with a few tables that have related (joined) fields. if > record in a one table (auxiliary) gets deleted (along with it's I would say this is the primary table. > primary key), reference to it in another table (main) points to And this is the

[SQL] data integrity

2000-08-15 Thread Sandis
Hello pgsql-sql, sorry for my question that is obviously a kind of lame and not related directly to postges, but i never dealt with it before & need an idea what to do right now. there is a db with a few tables that have related (joined) fields. if record in a one table (auxiliary) gets deleted

Re: [SQL] copy from

2000-08-15 Thread Adam Lang
I get it. I upload to the temp table, then for the select/insert I just do the nextval(seq_id) for the primary key field, correct? Adam Lang Systems Engineer Rutgers Casualty Insurance Company - Original Message - From: "Stephan Szabo" <[EMAIL PROTECTED]> To: "Adam Lang" <[EMAIL PROTECTE

Re: [SQL] Functions with Null Arguments?

2000-08-15 Thread DalTech - CTE
I would try using COALESCE(list) which will return the first non-NULL in the list. - Original Message - From: Thomas Swan To: [EMAIL PROTECTED] Sent: Tuesday, August 15, 2000 3:18 AM Subject: [SQL] Functions with Null Arguments? Is there anyway way to get the

Re: [SQL] postgresql and java2

2000-08-15 Thread Peter Mount
First sorry for the late reply, I only get this list from home, and just got email working again.   I was working on ARRAY and STRUCT for 7.0, but it a snag. I couldn't get a grips with what the spec meant, and couldn't work out how the SQL3 ARRAY type relates to our arrays. From the document

[SQL] 8K Limit, whats the best strategy?

2000-08-15 Thread Keith Wong
Hi everyone, Just wondering what strategies people have used to get around the 8K row limit in Postgres. If anyone has been troubled by this limitation before and has a nice solution around it, I would love to hear it. My application is a web-based system in which needs to store large amounts

[SQL] Language dependent fields

2000-08-15 Thread Volker Krebs
Hi, I want the content of a field to be language dependent. Therfore we have a Translation table which looks like this: tln_id tln_lng_id tln_text - 1 de hallo 1 en hello 2 de Herr 2 en

[SQL] My Indices doesn't work

2000-08-15 Thread Martin Dolog
Hi *, I have pgsql7.0.2 on Linux2.2.16 and table with following indices: CREATE TABLE T1 (NUM INT NOT NULL, NAME VARCHAR(10) NOT NULL, POP VARCHAR(10) NOT NULL); CREATE INDEX T1_I_NUM ON T1(NUM); CREATE INDEX T1_I_NAME ON T1(NAME); CREATE INDEX T1_I_POP ON T1(POP); ... and some data, but I real