Re: better way?



On 12 Aug., 09:14, Dennis Lee Bieber <wlfr...@xxxxxxxxxxxxx> wrote:
On Tue, 11 Aug 2009 11:45:50 -0700 (PDT), Pet <petshm...@xxxxxxxxxxxxxx>
declaimed the following in gmane.comp.python.general:

Oh, forgotten to mention. It's PostGres

        Really? There are still installations of an RDBMS that predates the
commonalization of SQL?

        I suspect you mean PostgreSQL -- it IS a different beast from the
older Postgres.

O, yeah. Of course it is PostgreSQL


        In either event -- my old books don't show an "all in one" solution.

        Best answer is probably to create some stored procedures which you
call instead of plain INSERT; the stored procedure could then do
whatever is needed to check for a duplicate (actually the easiest, I'd
think, would be: if primary key is supplied, it is an UPDATE; if primary
key is NULL or not supplied, it is an insert and the primary key will be
auto-generated).

I don't really like the idea of stored procedure, because query would
depend on existence of it then. On the other side, it looks like best
option.


--
        Wulfraed         Dennis Lee Bieber               KD6MOG
        wlfr...@xxxxxxxxxxxxx     HTTP://wlfraed.home.netcom.com/

.



Relevant Pages

  • Re: Cannot update identity column PointOfSaleID.
    ... I know its not good practice to change the primary key and we don't do ... Looking for a SQL Server replication book? ... The sp_MSupd_PointOfSales stored procedure checks to see if the bit ... column and if not it executes an update statement without the identity ...
    (microsoft.public.sqlserver.replication)
  • ERROR: cannot insert multiple commands into a prepared state
    ... Language Used: VC++ ... Back End: Postgres ... I am executing stored procedure through my vc++ code gives error but when ... My stored procedure is: ...
    (microsoft.public.vc.language)
  • Re: DB Concurrency
    ... I do already have a where in there to ensure i am updating the correct ... The primary key ensures this. ... >> record I just call a stored procedure passing over all the screen values, ... >> proc or do I have a generic stored proc for it or to I code it into the ...
    (microsoft.public.dotnet.general)
  • Re: dataset - Insert-query with stored procedure using wizard
    ... To solve my problem I tured off "Is RowGuid" in the database and instead ... With Crossposting (sending one message to relevant newsgroups) is no ... When I try to generate a stored procedure to insert new consumers I have ... to insert without adding the primary key because it is automatically ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Problem using SP as record source with Access2002 & SQL Server 7
    ... Create another stored procedure with the same Select statement but with the ... This clause should only take into account ... the primary key and the stored procedure to have only one argument, ... > the Resync Command property refer to the Input Parameters property? ...
    (microsoft.public.access.adp.sqlserver)