Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql Sql > Need a sample P...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 5 Topic 3555 of 3799
Post > Topic >>

Need a sample Postgre SQL script

by dhanu80@[EMAIL PROTECTED] ("Dhanushka Samarakoon") Jul 1, 2008 at 09:31 AM

------=_Part_21537_21408893.1214922714754
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Hi All,

I'm kind of new to Postgre and I need some advice.
I have the following table.
metadata (value:integer , field:integer , mydate:text)

given below is a sample record from that.
( 2 , 16 , Augest 2009)

I need a script that will read the above table and for each such row it
will
insert two rows as below.

( 2 , 91 , Augest )
( 2 , 86 , 2009 )

16, 91 and 86 are static values. *value and field together* creates the
primary key.

I could figure out and write the logic for this. I only need a little bit
similar sample script so that I can figure out Postgre syntax.
Like
- Loop syntax to through all the rows return by a select *
- How to assign that value to a parameter
- using that parameter in the Insert statement
- etc ...

Thanks,
Dhanushka.

------=_Part_21537_21408893.1214922714754
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Hi All,<br><br>I&#39;m kind of new to Postgre and I need some advice.<br>I
have the following table.<br>metadata (value:integer , field:integer ,
mydate:text)<br><br>given below is a sample record from that.<br>( 2 , 16
, Augest 2009)<br>

<br>I need a script that will read the above table and for each such row
it will insert two rows as below.<br><br>( 2 , 91 , Augest )<br>( 2 , 86 ,
2009 )<br><br>16, 91 and 86 are static values. <u>value and field
together</u> creates the primary key.<br>

<br>I could figure out and write the logic for this. I only need a little
bit similar sample script so that I can figure out Postgre syntax.<br>Like
<br>- Loop syntax to through all the rows return by a select *<br>- How to
assign that value to a parameter<br>

- using that parameter in the Insert statement<br>- etc
...<br><br>Thanks,<br>Dhanushka.<br>
<br>

------=_Part_21537_21408893.1214922714754--
 




 5 Posts in Topic:
Need a sample Postgre SQL script
dhanu80@[EMAIL PROTECTED]  2008-07-01 09:31:54 
Re: Need a sample Postgre SQL script
dev@[EMAIL PROTECTED] (R  2008-07-01 15:42:48 
Re: Need a sample Postgre SQL script
dhanu80@[EMAIL PROTECTED]  2008-07-01 09:53:02 
Re: Need a sample Postgre SQL script
dev@[EMAIL PROTECTED] (R  2008-07-01 16:17:30 
Re: Need a sample Postgre SQL script
dhanu80@[EMAIL PROTECTED]  2008-07-02 12:12:37 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Tue Dec 2 21:39:53 CST 2008.