Received: from lerami.lerctr.org (lerami.lerctr.org [207.158.72.11]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f4EI0TA09419 for ; Mon, 14 May 2001 14:00:29 -0400 (EDT) (envelope-from ler@lerctr.org) Received: from ler-freebie.iadfw.net (ler-freebie.iadfw.net [206.66.13.221]) by lerami.lerctr.org (8.12.0.Beta7/8.12.0.Beta7/20010318/$Revision: 1.22 $) with SMTP id f4EI0OEI020898 for ; Mon, 14 May 2001 13:00:25 -0500 (CDT) (envelope-from ler@lerctr.org) From: Larry Rosenman Date: Mon, 14 May 2001 18:00:25 GMT Message-ID: <20010514.18002500@ler-freebie.iadfw.net> Subject: plpgsql function / ??? / help To: pgsql-sql@postgresql.org X-Mailer: Mozilla/3.0 (compatible; StarOffice/5.2; Linux) X-Priority: 3 (Normal) MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by postgresql.org id f4EI0XA09444 X-Archive-Number: 200105/126 X-Sequence-Number: 2942 I have the following 2 tables, and a spread sheet that needs to be converted to the assigned_networks table. In the spreadsheet there is an approximation of the router name, but it needs some massaging. I need to load the id field of the router table into the router field of the assigned networks table. Is there an easy way to code a function that can massage the name to the correct DNS name to do this at insert time? Thanks! LER -- Larry Rosenman http://www.lerctr.org/~ler/ Phone: +1 972 414 9812 E-Mail: ler@lerctr.org US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749 US ler=# \d router Table "router" Attribute | Type | Modifier -----------+------------------------+----------------------------------- ---------------- id | integer | not null default nextval('"router_id_seq"'::text) name | character varying(256) | ethernet | inet | model | character varying(256) | nexthop | inet | comments | character varying(256) | Index: router_pkey ler=# \d assigned_networks Table "assigned_networks" Attribute | Type | Modifier -------------------+------------------------+---------- netblock | cidr | router | integer | interface | character varying(256) | dest_ip | inet | mis_token | character(16) | assigned_date | date | assigned_by | character varying(256) | justification_now | integer | justification_1yr | integer | cust_asn | smallint | ler=#