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








[SQL] hi how to use encryption for incomtax in postgresql

2006-05-26 Thread Penchalaiah P.








hi sir

 

how to use encryption to password in postgresql with examples

 

Thanks  &  Regards

Penchal reddy | Software Engineer
  

Infinite Computer Solutions | Exciting Times…Infinite Possibilities... 

SEI-CMMI level 5 | ISO 9001:2000

IT SERVICES |
BPO  


Telecom | Finance
| Healthcare | Manufacturing
| Energy & Utilities | Retail
& Distribution | Government   


Tel +91-80-5193-(Ext:503)| Fax  +91-80-51930009 | Cell No  +91-9980012376|www.infics.com  

Information transmitted by this e-mail is
proprietary to Infinite Computer Solutions and/ or its Customers and is
intended for use only by the individual or entity to which it is addressed, and
may contain information that is privileged, confidential or exempt from
disclosure under applicable law. If you are not the intended recipient or it
appears that this mail has been forwarded to you without proper authority, you
are notified that any use or dissemination of this information in any manner is
strictly prohibited. In such cases, please notify us immediately at [EMAIL PROTECTED] and delete this mail from your records.

 








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

2006-05-26 Thread Andrew Sullivan
On Fri, May 26, 2006 at 05:11:26PM +0700, andi wrote:
> select rank() over(order by testeridpk ) as rank , * from tester;
> 
> I get the result is like this, 
> 
> 
> RANK   TESTERIDPK   TESTER_NAME
> 
> 1 10TESSS
> 
> 2 90NAMAAA
> 
> 3 100   
> 
> 
> How in postgres sql I get the same result , please help me, because iam
> really frustating with this duty.

There's no built in for that that I know of.  You could use a
temporary sequence to do it:

BEGIN;
CREATE SEQUENCE tempseq;
SELECT nextval('tempseq') as rank, testeridpk, tester_name FROM testers
ORDER BY testeridpk;
ROLLBACK;

which, I _think_, will get you what you want (i.e. that's not
tested).  The ROLLBACK is just there to clean up the sequence.

A

-- 
Andrew Sullivan  | [EMAIL PROTECTED]
"The year's penultimate month" is not in truth a good way of saying
November.
--H.W. Fowler

---(end of broadcast)---
TIP 5: don't forget to increase your free space map settings


Re: [SQL] hi how to use encryption for incomtax in postgresql

2006-05-26 Thread Andrew Sullivan
On Fri, May 26, 2006 at 04:01:47PM +0530, Penchalaiah P. wrote:
> hi sir
> 
>  
> 
> how to use encryption to password in postgresql with examples

I guess you want to read this:

http://www.postgresql.org/docs/8.1/interactive/client-authentication.html

?

A

-- 
Andrew Sullivan  | [EMAIL PROTECTED]
If they don't do anything, we don't need their acronym.
--Josh Hamilton, on the US FEMA

---(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


Re: [SQL] hi how to use encryption for incomtax in postgresql

2006-05-26 Thread Richard Huxton

Penchalaiah P. wrote:

hi sir

how to use encryption to password in postgresql with examples


It depends on what you're trying to achieve - password protection, 
concealing data, encrypting a connection.


The md5() function is built-in, and may be suitable for password 
protection on a simple web app.


The pg_crypto module in the contrib directory of the source distribution 
(or the extras package of your particular distribution) gives examples 
of various encryption and hashing functions it supports.


Encrypted connections are handled by the ssl library - see Chapter 20. 
"Client Authentication" in the manuals.


HTH
--
  Richard Huxton
  Archonet Ltd

---(end of broadcast)---
TIP 4: Have you searched our list archives?

  http://archives.postgresql.org


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

2006-05-26 Thread Bruno Wolff III
On Fri, May 26, 2006 at 06:50:37 -0400,
  Andrew Sullivan <[EMAIL PROTECTED]> wrote:
> On Fri, May 26, 2006 at 05:11:26PM +0700, andi wrote:
> > select rank() over(order by testeridpk ) as rank , * from tester;
> > 
> > I get the result is like this, 
> > 
> > 
> > RANK   TESTERIDPK   TESTER_NAME
> > 
> > 1 10TESSS
> > 
> > 2 90NAMAAA
> > 
> > 3 100   
> > 
> > 
> > How in postgres sql I get the same result , please help me, because iam
> > really frustating with this duty.

The simplest solution is to add the rank information in your application as
it reads the result set.

> There's no built in for that that I know of.  You could use a
> temporary sequence to do it:
> 
> BEGIN;
> CREATE SEQUENCE tempseq;
> SELECT nextval('tempseq') as rank, testeridpk, tester_name FROM testers
>   ORDER BY testeridpk;
> ROLLBACK;
> 
> which, I _think_, will get you what you want (i.e. that's not
> tested).  The ROLLBACK is just there to clean up the sequence.

Rollbacks will not reset sequence values. Use setval to do that.

---(end of broadcast)---
TIP 5: don't forget to increase your free space map settings


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

2006-05-26 Thread Andrew Sullivan
On Fri, May 26, 2006 at 09:08:20AM -0500, Bruno Wolff III wrote:
> 
> Rollbacks will not reset sequence values. Use setval to do that.

No, what I posted was the CREATE SEQUENCE after the BEGIN.  ROLLBACK
gets rid of the sequence.  The next time you create the same
sequence, therefore, it also starts at 1.

I don't actually know what this ranking is useful for, to be honest,
but people ask for it, and this is a stupid Postgres trick that can
make it happen.

A

-- 
Andrew Sullivan  | [EMAIL PROTECTED]
The plural of anecdote is not data.
--Roger Brinner

---(end of broadcast)---
TIP 6: explain analyze is your friend