andi wrote:
Dear friends,

I have table

MD_CUSTOMER

MD_CUSTOMERIDPK integer primary key
NAME                           varchar

OK - two columns.

But my primary key is not in correct order like

MD_CUSTOMER

MD_CUSTOMERIDPK                     NAME

10
ANDI

33
TESTER

100                                                            KKK

Not sure what you mean. What does it mean for your primary key to be in the "correct order"? I assume you know how to select rows in a specific order using the "ORDER BY" clause?


, so I want to make other primary key to generate sequences 1, 2, 3, . and

How can you have *another* primary key? By definition there can only be one primary key.

in MS SQL SERVER 2005

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

If all you want to do is generate a series of numbers you might look at generate_series(), or if you'd like a "row number" then something like:

CREATE TEMPORARY SEQUENCE myseq;
SELECT *,nextval('myseq') FROM mytable;

I have to say though, I'm not sure what you're trying to do. I do get the feeling I'd think it was a bad idea once I found out though.

--
  Richard Huxton
  Archonet Ltd

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
      choose an index scan if your joining column's datatypes do not
      match

Reply via email to