Re: [SQL] Understanding Binary Data Type

2012-05-24 Thread F. BROUARD / SQLpro
Hi Le 22/05/2012 19:13, Carlos Mennens a écrit : Hello everyone! I wanted to ask the list a question about the 'bytea' data type& how I can picture this in my head. I've been reading SQL for about a few months now and since then, I've only been working with textual data. Basically I'm familiar

Re: [SQL] Natural sort order

2012-03-01 Thread F. BROUARD / SQLpro
The fastest way is to create a ref table with all possible entries, ordered with an additionnal numerical column, indexing it and make a join from your table to this ref table. A + Le 17/12/2011 11:33, Richard Klingler a écrit : Morning... What is the fastest way to achieve natural ordering

Re: [SQL] MS-SQL Store Procedure to Postgresql Function

2012-02-02 Thread F. BROUARD / SQLpro
Actullay there is no transaction support in internal PG routines. So the code you posted is not translatable in PG PL/SQL because it involve a transaction inside the process. A + Le 30/01/2012 07:42, Rehan Saleem a écrit : hi , how i can convert this store procedure to PostgreSQL function, e

Re: [SQL] [GENERAL] Creating rule for sliding data

2011-10-09 Thread F. BROUARD / SQLpro
I am answering to myseilf... the good syntax is something like : CREATE RULE R_U_MSR_BEFORE2000x AS ON UPDATE TO T_MESURE_MSR WHERE ( NEW.MSR_DATE < DATE '2000-01-01' ) DO INSTEAD ( -- rows does not change partition : UPDATE T_MESURE_BEFORE2000_MSR SET MSR_ID = NEW.MSR_ID, MSR_

[SQL] [GENERAL] Creating rule for sliding data

2011-10-09 Thread F. BROUARD / SQLpro
Hello, I have a problem to find the good syntax for a rule for rows going for one partition to the other in cas of an update. Let me give the conditions : 1 - having a mother table CREATE TABLE T_MESURE_MSR ( MSR_ID INT NOT NULL, MSR_DATEDATE NOT NULL, MSR_MESURE FLOAT NOT

Re: [SQL] Merge overlapping time-periods

2011-06-15 Thread F. BROUARD / SQLpro
I write a paper on this topic comparing queries for PG, SQL Server and MySQL. Can you read french ? http://blog.developpez.com/sqlpro/p9821/langage-sql-norme/agregation-d-intervalles-en-sql-1/ The worst query is the RECURSIVE one ! A + Le 15/06/2011 17:23, Jira, Marcel a écrit : Hi! Althou

[SQL] FOR EACH STATEMENT trigger ?

2011-05-06 Thread F. BROUARD / SQLpro
Hi there I am trying to get an example of SET BASED trigger logic with FOR EACH STATEMENT, but I cannot find any example involving the pseudo table NEW (or OLD) in the trigger function SQL statement. Let me give you a real life example. Suppose we have the above table : CREATE TABLE T_PRODUIT