pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Lothar Behrens <lothar.behrens@lollisoft.de>
To: pgsql-odbc@postgresql.org
Subject: declaring variable ?
Date: Sun, 1 Jul 2007 14:03:14 +0200
Message-ID: <4802078e6d43acd33ae04dc0f8a652b3@lollisoft.de> (raw)

Hi,

I am searching for a way to do the following (MS SQL) in PostgreSQL:

declare @key as int

set @key = (select ID from table1 where name = '...')

insert into table2 (foreignkey, foreignvalue) values(@key, 'some value 
here')

I didn't find such a syntax in the documentation.

Regards, Lothar

--
Lothar Behrens				|	Rapid Prototyping ...
Heinrich-Scheufelen-Platz 2		|	
73252 Lenningen  				|	www.lollisoft.de




Message-ID: <4802078e6d43acd33ae04dc0f8a652b3@lollisoft.de>
Permalink:  ../4802078e6d43acd33ae04dc0f8a652b3@lollisoft.de/
Also on:    postgresql.org/message-id/4802078e6d43acd33ae04dc0f8a652b3@lollisoft.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-odbc@postgresql.org
  Cc: lothar.behrens@lollisoft.de
  Subject: Re: declaring variable ?
  In-Reply-To: <4802078e6d43acd33ae04dc0f8a652b3@lollisoft.de>
  References: <4802078e6d43acd33ae04dc0f8a652b3@lollisoft.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox