Harvinder,

Let's see what we can come up with:

insert into t_suspended_txn
select 'A', 'B'
from dual
where exists (select col1 from t_suspended_txn where col2 = 'A')

Although I don't honestly know if "dual" exists in SQL Server (in Oracle
it's a single row, single column table - you could easily create a "dual"
in SQL Server), otherwise:

insert into t_suspended_txn
select distinct 'A', 'B'
from t_suspended_txn where col2 = 'A'

This would work but might do an unnecessarily large sort if t_suspended_txn
contains many rows, otherwise:

insert into t_suspended_txn
select 'A', 'B'
from t_suspended_txn where col2 = 'A' and rownum = 1

Although again, I don't know if SQL Server supports "rownum" as a pseudo
column.

Hopefully I've given enough ideas to find something that works though.

Cheers,
     Mark.




                                                                                       
                                   
                    "Harvinder Singh"                                                  
                                   
                    <Harvinder.Singh@Metr       To:     Multiple recipients of list 
ORACLE-L <[EMAIL PROTECTED]>       
                    aTech.com>                  cc:                                    
                                   
                    Sent by:                    Subject:     how to modify query       
                                   
                    [EMAIL PROTECTED]                                                   
                                   
                                                                                       
                                   
                                                                                       
                                   
                    05/12/2002 06:04                                                   
                                   
                    Please respond to                                                  
                                   
                    ORACLE-L                                                           
                                   
                                                                                       
                                   
                                                                                       
                                   




Hi,

Following code works in sql server but IF NOT EXISTS dosn't work in oracle
how can we modify this code so that it should work on both sql server and
oracle

 if not exists (
select
col1
from
t_suspended_txn
where
col2  ='A'
begin
insert into t_suspended_txn
select  'A' ,  'B'
end


Thanks
--Harvinder


<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<---->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
   Privileged/Confidential information may be contained in this message.
          If you are not the addressee indicated in this message
       (or responsible for delivery of the message to such person),
            you may not copy or deliver this message to anyone.
In such case, you should destroy this message and kindly notify the sender
           by reply e-mail or by telephone on (61 3) 9612-6999.
   Please advise immediately if you or your employer does not consent to
                Internet e-mail for messages of this kind.
        Opinions, conclusions and other information in this message
              that do not relate to the official business of
                         Transurban City Link Ltd
         shall be understood as neither given nor endorsed by it.
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<---->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Mark Richard
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).

Reply via email to