[SQL] PLEASE help ME , HOW TO GENERATE PRIMARY Keys on the fly

2006-05-24 Thread andi








Dear friends,

 

I have table

MD_CUSTOMER

MD_CUSTOMERIDPK integer
primary key

NAME   varchar

 

 

But my primary key is not in correct order like

MD_CUSTOMER

MD_CUSTOMERIDPK NAME

10   
ANDI

33   
TESTER

100    KKK

 

, so I want to make other primary key to generate sequences 1, 2, 3, …
and in MS SQL SERVER 2005

I can with Rank() function , but in Postgres how ?

 

PLEASE any one can help me, I am really appreciate.

 

Best regards

 

Andi kusnadi








Re: [SQL] PLEASE help ME , HOW TO GENERATE PRIMARY Keys on the fly

2006-05-26 Thread andi








When  I use this syntax

select * from TESTER;

I got 

 

TESTERIDPK  TESTER_NAME

10   TE

90       NAM

100  U

 

In ms sql server 2005 I use this 

select rank()
over(order
by testeridpk ) as rank , *
from tester;

I get the result is like
this, 

 

RANK   TESTERIDPK   TESTER_NAME

1 10    TESSS

2 90        NAMAAA

3 100   

 

 

How in postgres sql I get the same result ,
please help me, because iam really frustating with this duty.

 

Thank you








Re: [SQL] PLEASE help ME , HOW TO GENERATE PRIMARY Keys on the fly

2006-05-28 Thread andi








Dear friends,

 

I have seen this is very drawback of our beloved postgres
databases, postgres do not support sql 2003 standards, 

 I hope soon we can support this standards.

 

Thank you