Results 1 to 2 of 2
  1. #1
    Join Date
    May 2014
    Posts
    16

    Unanswered: is there an equivalent in Postgresql for MS SQL BEGIN TRANSACTION?

    is there an equivalent in Postgresql for sql server's BEGIN TRANSACTION?

    In sql server you could use Begin Transaction before a update statement, run it and then do a select on the table and see the update changes on the table. then perform a commit or rollback if the results are what you intended.

    I tried using the BEGIN command in postgresql, but then when I go to run my select statement on the updated table, I don't see where the update took place.

    Code:
    BEGIN;
    -------------------------------------------------
    -- End Date all HYU Power Proctect Records -
    -------------------------------------------------
    Update sg_dlr_da 
    Set sg_dlra_ebdate = '2014-07-23'
       ,sg_dlra_mtby = 'IT'
    
    Where sg_dlra_dealer like '%HYU%' 
     and sg_dlra_plc like 'PP%';
    
    --Select sg_dlra_dealer
    --      ,sg_dlra_plc
    --      ,sg_dlra_conpmt as Contracts
    --      ,sg_dlra_clmpmt  as Claims
    --      ,sg_dlra_canpmt as Cancellations
    --      ,sg_dlra_sbdate  as "Start Bus Date"
    --      ,sg_dlra_ebdate  as "End Bus Date"
    
    --      ,sg_dlra_crby    as "Entered By"
    --      ,sg_dlra_crdt    as "Date Created"
    --      ,sg_dlra_mtby    as "Modified By" 
    
          
    --From sg_dlr_da 
    
    --Where sg_dlra_dealer like '%HYU%' 
    -- and sg_dlra_plc like 'PP%';
    

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    START TRANSACTION is the PostgreSQL equivalent to the MS-SQL BEGIN TRANSACTION.

    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •