[SQL] \set

2004-05-11 Thread Jie Liang
Hi, How to use an internal variable? Original question was how to set a variable in postgresql? If I want to set a variable like start_date='2004-05-10'; How could I use it in my SQL statement? E.g. Db> set start_date '2004-05-10' Db> select start_date as 'start date'; It's not executable! Than

Re: [SQL] Info

2004-05-11 Thread scott.marlowe
On Tue, 11 May 2004, [koi8-r] "Slava Ilijin[koi8-r] " wrote: > > > > Hello, I have inserted a data bank in SQL server 2000 and from it have > generated a Script. I would like to convert to this Script in > postgresql, but I don't know like this does. I become to you very > thankfully for e

[SQL] Seconds To Time

2004-05-11 Thread Willem de Jong
Hi all, I'm a newby to PGSQL, I allways use MySQL, but now we use PGSQL, so i had to convert all the MySQL-Query's to PGSQL. In MySQL we have the function Sec_to_time(seconds). This will result a time-value like '40:30:00'. With this Query SELECT TIMESTAMP WITH TIME ZONE 'epoch' + sum(elapse

Re: [SQL] Subqueries returning more than one value?

2004-05-11 Thread CoL
hi, Adam Witney wrote, On 5/11/2004 02:09: Hi, I am using a function in a subquery, this works ok: SELECT name, (SELECT p_my_func(1)) AS id FROM test; However I would like to have the function return 2 values into the main query... Something like this: SELECT name, (SELECT p_my_func(1)) AS (id

Re: [SQL] Trigger function to know which fields are being updated

2004-05-11 Thread Riccardo Facchini
> --- Bernard Cheung <[EMAIL PROTECTED]> wrote: > > Thank you, but my intension is to check whether the user supplies > > NAME when > > updating the record. > > > > For example the trigger shall allow statement 1 and block statement > > 2: > > > > 1. UPDATE COMPANY SET NAME = 'ABC', ADDRESS = '1

[SQL] Info

2004-05-11 Thread "Slava Ilijin"
Hello, I have inserted a data bank in SQL server 2000 and from it have generated a Script. I would like to convert to this Script in postgresql, but I don't know like this does. I become to you very thankfully for every kind of information. Yours sincerely Sven ---(e

Re: [SQL] Trigger function to know which fields are being updated

2004-05-11 Thread Jeff Eckermann
--- Bernard Cheung <[EMAIL PROTECTED]> wrote: > Thank you, but my intension is to check whether the > user supplies NAME when > updating the record. > > For example the trigger shall allow statement 1 and > block statement 2: > > 1. UPDATE COMPANY SET NAME = 'ABC', ADDRESS = '123 > Drive' WHERE

Re: [SQL] Trigger function to know which fields are being updated

2004-05-11 Thread Bernard Cheung
Thank you, but my intension is to check whether the user supplies NAME when updating the record. For example the trigger shall allow statement 1 and block statement 2: 1. UPDATE COMPANY SET NAME = 'ABC', ADDRESS = '123 Drive' WHERE COMPANY_ID = 1; 2. UPDATE COMPANY SET ADDRESS = '123 Drive' WH