On 03/17/10 17:52, Ignacio Balcarce wrote:
CREATE PROCEDURE dbo.THUBAN_SP_GENERATEID
@NEWID VARCHAR(20) OUTPUT
AS
SET @NEWID = (
SELECT REPLACE(SUBSTRING(CONVERT(CHAR(10),GETDATE(),20 ),1,10),'-','')
+ CAST(REPLICATE(0,8-LEN (ISNULL(CAST(SUBSTRING(MAX(SEQ_ID),9,8) AS
INTEGER),0) +
On 03/17/10 17:52, Ignacio Balcarce wrote:
-- IF EXISTS A ROW IN THE TABLE STARTING WITH THE CURRENT_DATE
Sorry, your field is not an atom => your database does not met a FIRST
normal form.
it needs normalization urgently.
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To mak
I want to do:
SELECT id, count(*) FROM mytable WHERE count(*) > 2 GROUP BY id;
But this doesn't work because Pg won't allow aggregate functions in a
where clause. So I modified it to:
SELECT id, count(*) AS cnt FROM mytable WHERE cnt > 2 GROUP BY id;
But Pg still complains (that column cnt
Mark,
Change your query to this:
SELECT id, count(*) FROM mytable GROUP BY id HAVING count(*) > 2;
-Original Message-
From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-ow...@postgresql.org] On
Behalf Of Mark Fenbers
Sent: Thursday, March 18, 2010 10:07 AM
To: pgsql-sql@postgresql
Mark Fenbers writes:
> I want to do:
> SELECT id, count(*) FROM mytable WHERE count(*) > 2 GROUP BY id;
> But this doesn't work because Pg won't allow aggregate functions in a
> where clause.
Use HAVING, not WHERE. The way you are trying to write the query is
meaningless because WHERE filters
Thanks, Joe and Tom. You cleared the webs out of my brain. I used
HAVING before, but not lately and I got rusty.
Mark
Tom Lane wrote:
Mark Fenbers writes:
I want to do:
SELECT id, count(*) FROM mytable WHERE count(*) > 2 GROUP BY id;
But this doesn't work b
On 3/17/2010 9:52 AM, Ignacio Balcarce wrote:
>
> Hi all,
>
> I am facing a problem trying to convert from MSSQL procedure to
> PostgreSQL function.
>
> CREATE PROCEDURE dbo.THUBAN_SP_GENERATEID
>
> @NEWID VARCHAR(20) OUTPUT
>
> AS
>
> SET @NEWID = (
>
> SELECT REPLACE(SUBSTRING(CONVERT(C
On 3/18/2010 12:53 PM, Ignacio Balcarce wrote:
>
> Justin,
>
> Thanks in advance for your email. I forgot to tell than everyday IDs
> must start from 0. So… sequence id would look like: MMDD 0001,
> MMDD 0002, etc.
>
> Is there any way to make this sequence start from 0 every day?
OOPS did not mean to click send
On 3/18/2010 12:53 PM, Ignacio Balcarce wrote:
>
> Justin,
>
> Thanks in advance for your email. I forgot to tell than everyday IDs
> must start from 0. So… sequence id would look like: MMDD 0001,
> MMDD 0002, etc.
>
> Is there any way to make this
Justin,
Thanks in advance for your email. I forgot to tell than everyday IDs must start
from 0. So… sequence id would look like: MMDD 0001, MMDD 0002,
etc.
Is there any way to make this sequence start from 0 every day?
Thanks & Regards,
Ignacio
De: Justin Graf
Hello all Emacs users!
I am using Emacs recently. I love sql-mode, to use with PostgreSQL,
but I have problems with it.
When my SQL file (or buffer) are small (50-100 lines) I can send
it to SQLi buffer without any problems. But when I working with
large SQL file (e.g. complex database model, thou
Dmitriy Igrishin writes:
> I am using Emacs recently. I love sql-mode, to use with PostgreSQL,
> but I have problems with it.
> When my SQL file (or buffer) are small (50-100 lines) I can send
> it to SQLi buffer without any problems. But when I working with
> large SQL file (e.g. complex database
Hello
try to look on
http://www.postgres.cz/index.php/PostgreSQL_SQL_Tricks#Terminal.27s_configuration
Regards
Pavel Stehule
2010/3/18 Dmitriy Igrishin :
> Hello all Emacs users!
>
> I am using Emacs recently. I love sql-mode, to use with PostgreSQL,
> but I have problems with it.
> When my SQL
2010/3/18 Tom Lane :
> Dmitriy Igrishin writes:
>> I am using Emacs recently. I love sql-mode, to use with PostgreSQL,
>> but I have problems with it.
>> When my SQL file (or buffer) are small (50-100 lines) I can send
>> it to SQLi buffer without any problems. But when I working with
>> large SQL
14 matches
Mail list logo