Professional Web Applications Themes

Trigger - wont allow me to insert - Microsoft SQL / MS SQL Server

Hello: I have the following trigger working fine - the problem is that I can do an insert into the table? What is the problem. CREATE TRIGGER [AuditInsert3] ON dbo.booking_up_revb FOR insert AS INSERT INTO AuditTrail2 (TableName,booking_no,actionTaken, ActionUser, ActionDate,Ocean,CNEE, Shipper, Descrip , Org, Dest, Cont_20, Cont_40, Cont_HQ , Cont_45 , Cont_cbm, PCS , GWT , Vol_wt , Hawb_Hbl , Container , Book_date , Comments , PO , CI , Carrier1 , Carrier2 , Carrier3 , Ves_Flt1 , Ves_Flt2, Ves_Flt3 , clsg_date1, clsg_date2 , clsg_date3 , ETD1 , ETD2 , ETD3 , ETA1 , ETA2 , ETA3 , Unlading_port1 , Unlading_port2 ...

  1. #1

    Default Trigger - wont allow me to insert

    Hello:

    I have the following trigger working fine - the problem is
    that I can do an insert into the table? What is the
    problem.


    CREATE TRIGGER [AuditInsert3] ON dbo.booking_up_revb
    FOR insert
    AS
    INSERT INTO AuditTrail2
    (TableName,booking_no,actionTaken, ActionUser,
    ActionDate,Ocean,CNEE, Shipper,
    Descrip ,
    Org,
    Dest,
    Cont_20,
    Cont_40,
    Cont_HQ ,
    Cont_45 ,
    Cont_cbm,
    PCS ,
    GWT ,
    Vol_wt ,
    Hawb_Hbl ,
    Container ,
    Book_date ,
    Comments ,
    PO ,
    CI ,
    Carrier1 ,
    Carrier2 ,
    Carrier3 ,
    Ves_Flt1 ,
    Ves_Flt2,
    Ves_Flt3 ,
    clsg_date1,
    clsg_date2 ,
    clsg_date3 ,
    ETD1 ,
    ETD2 ,
    ETD3 ,
    ETA1 ,
    ETA2 ,
    ETA3 ,
    Unlading_port1 ,
    Unlading_port2 ,
    Unlading_port3 ,
    Unlad_port_ETA1 ,
    Unlad_port_ETA2 ,
    Unlad_port_ETA3 ,
    Final_dest1 ,
    Final_dest2 ,
    Final_dest3 ,
    service1 ,
    service2 ,
    service3 ,
    cost1 ,
    cost2 ,
    cost3 ,
    confirm1 ,
    confirm2 ,
    confirm3 )

    select 'booking_up_revb',booking_no,
    'I', user_name(), GetDate(), Ocean,CNEE, Shipper,
    Descrip ,
    Org,
    Dest,
    Cont_20,
    Cont_40,
    Cont_HQ ,
    Cont_45 ,
    Cont_cbm ,
    PCS ,
    GWT ,
    Vol_wt ,
    Hawb_Hbl ,
    Container ,
    Book_date ,
    Comments ,
    PO ,
    CI ,
    Carrier1 ,
    Carrier2 ,
    Carrier3 ,
    Ves_Flt1 ,
    Ves_Flt2,
    Ves_Flt3 ,
    clsg_date1,
    clsg_date2 ,
    clsg_date3 ,
    ETD1 ,
    ETD2 ,
    ETD3 ,
    ETA1 ,
    ETA2 ,
    ETA3 ,
    Unlading_port1 ,
    Unlading_port2 ,
    Unlading_port3 ,
    Unlad_port_ETA1 ,
    Unlad_port_ETA2 ,
    Unlad_port_ETA3 ,
    Final_dest1 ,
    Final_dest2 ,
    Final_dest3 ,
    service1 ,
    service2 ,
    service3 ,
    cost1 ,
    cost2 ,
    cost3 ,
    confirm1 ,
    confirm2 ,
    confirm3
    from inserted








    pat Guest

  2. #2

    Default Re: Trigger - wont allow me to insert

    Pat,

    Can you be a little more descriptive with what the actual problem is? What
    is the error you get?

    --

    Andrew J. Kelly
    SQL Server MVP


    "pat" <Pmcel123cox.net> wrote in message
    news:490001c340ee$9074be70$a401280aphx.gbl...
    > Hello:
    >
    > I have the following trigger working fine - the problem is
    > that I can do an insert into the table? What is the
    > problem.
    >
    >
    > CREATE TRIGGER [AuditInsert3] ON dbo.booking_up_revb
    > FOR insert
    > AS
    > INSERT INTO AuditTrail2
    > (TableName,booking_no,actionTaken, ActionUser,
    > ActionDate,Ocean,CNEE, Shipper,
    > Descrip ,
    > Org,
    > Dest,
    > Cont_20,
    > Cont_40,
    > Cont_HQ ,
    > Cont_45 ,
    > Cont_cbm,
    > PCS ,
    > GWT ,
    > Vol_wt ,
    > Hawb_Hbl ,
    > Container ,
    > Book_date ,
    > Comments ,
    > PO ,
    > CI ,
    > Carrier1 ,
    > Carrier2 ,
    > Carrier3 ,
    > Ves_Flt1 ,
    > Ves_Flt2,
    > Ves_Flt3 ,
    > clsg_date1,
    > clsg_date2 ,
    > clsg_date3 ,
    > ETD1 ,
    > ETD2 ,
    > ETD3 ,
    > ETA1 ,
    > ETA2 ,
    > ETA3 ,
    > Unlading_port1 ,
    > Unlading_port2 ,
    > Unlading_port3 ,
    > Unlad_port_ETA1 ,
    > Unlad_port_ETA2 ,
    > Unlad_port_ETA3 ,
    > Final_dest1 ,
    > Final_dest2 ,
    > Final_dest3 ,
    > service1 ,
    > service2 ,
    > service3 ,
    > cost1 ,
    > cost2 ,
    > cost3 ,
    > confirm1 ,
    > confirm2 ,
    > confirm3 )
    >
    > select 'booking_up_revb',booking_no,
    > 'I', user_name(), GetDate(), Ocean,CNEE, Shipper,
    > Descrip ,
    > Org,
    > Dest,
    > Cont_20,
    > Cont_40,
    > Cont_HQ ,
    > Cont_45 ,
    > Cont_cbm ,
    > PCS ,
    > GWT ,
    > Vol_wt ,
    > Hawb_Hbl ,
    > Container ,
    > Book_date ,
    > Comments ,
    > PO ,
    > CI ,
    > Carrier1 ,
    > Carrier2 ,
    > Carrier3 ,
    > Ves_Flt1 ,
    > Ves_Flt2,
    > Ves_Flt3 ,
    > clsg_date1,
    > clsg_date2 ,
    > clsg_date3 ,
    > ETD1 ,
    > ETD2 ,
    > ETD3 ,
    > ETA1 ,
    > ETA2 ,
    > ETA3 ,
    > Unlading_port1 ,
    > Unlading_port2 ,
    > Unlading_port3 ,
    > Unlad_port_ETA1 ,
    > Unlad_port_ETA2 ,
    > Unlad_port_ETA3 ,
    > Final_dest1 ,
    > Final_dest2 ,
    > Final_dest3 ,
    > service1 ,
    > service2 ,
    > service3 ,
    > cost1 ,
    > cost2 ,
    > cost3 ,
    > confirm1 ,
    > confirm2 ,
    > confirm3
    > from inserted
    >
    >
    >
    >
    >
    >
    >
    >

    Andrew J. Kelly Guest

  3. #3

    Default Re: Trigger - wont allow me to insert

    Andrew:

    The error I am receiving is as follows:

    "ODBC--Call Failed
    [Microsoft] [odbc sql driver] string data, right
    truncation (#0)"

    I am connecting to the database via ODBC - Acess 2000. I
    have no problem connecting to the database and can do an
    insert if the I drop the trigger. As soon as I implement
    the trigger then I get the same errror.

    I can do a direct insert into the table.

    Thanks for your assistance.

    Pat

    >-----Original Message-----
    >Pat,
    >
    >Can you be a little more descriptive with what the actual
    problem is? What
    >is the error you get?
    >
    >--
    >
    >Andrew J. Kelly
    >SQL Server MVP
    >
    >
    >"pat" <Pmcel123cox.net> wrote in message
    >news:490001c340ee$9074be70$a401280aphx.gbl...
    >> Hello:
    >>
    >> I have the following trigger working fine - the problem
    is
    >> that I can do an insert into the table? What is the
    >> problem.
    >>
    >>
    >> CREATE TRIGGER [AuditInsert3] ON dbo.booking_up_revb
    >> FOR insert
    >> AS
    >> INSERT INTO AuditTrail2
    >> (TableName,booking_no,actionTaken, ActionUser,
    >> ActionDate,Ocean,CNEE, Shipper,
    >> Descrip ,
    >> Org,
    >> Dest,
    >> Cont_20,
    >> Cont_40,
    >> Cont_HQ ,
    >> Cont_45 ,
    >> Cont_cbm,
    >> PCS ,
    >> GWT ,
    >> Vol_wt ,
    >> Hawb_Hbl ,
    >> Container ,
    >> Book_date ,
    >> Comments ,
    >> PO ,
    >> CI ,
    >> Carrier1 ,
    >> Carrier2 ,
    >> Carrier3 ,
    >> Ves_Flt1 ,
    >> Ves_Flt2,
    >> Ves_Flt3 ,
    >> clsg_date1,
    >> clsg_date2 ,
    >> clsg_date3 ,
    >> ETD1 ,
    >> ETD2 ,
    >> ETD3 ,
    >> ETA1 ,
    >> ETA2 ,
    >> ETA3 ,
    >> Unlading_port1 ,
    >> Unlading_port2 ,
    >> Unlading_port3 ,
    >> Unlad_port_ETA1 ,
    >> Unlad_port_ETA2 ,
    >> Unlad_port_ETA3 ,
    >> Final_dest1 ,
    >> Final_dest2 ,
    >> Final_dest3 ,
    >> service1 ,
    >> service2 ,
    >> service3 ,
    >> cost1 ,
    >> cost2 ,
    >> cost3 ,
    >> confirm1 ,
    >> confirm2 ,
    >> confirm3 )
    >>
    >> select 'booking_up_revb',booking_no,
    >> 'I', user_name(), GetDate(), Ocean,CNEE, Shipper,
    >> Descrip ,
    >> Org,
    >> Dest,
    >> Cont_20,
    >> Cont_40,
    >> Cont_HQ ,
    >> Cont_45 ,
    >> Cont_cbm ,
    >> PCS ,
    >> GWT ,
    >> Vol_wt ,
    >> Hawb_Hbl ,
    >> Container ,
    >> Book_date ,
    >> Comments ,
    >> PO ,
    >> CI ,
    >> Carrier1 ,
    >> Carrier2 ,
    >> Carrier3 ,
    >> Ves_Flt1 ,
    >> Ves_Flt2,
    >> Ves_Flt3 ,
    >> clsg_date1,
    >> clsg_date2 ,
    >> clsg_date3 ,
    >> ETD1 ,
    >> ETD2 ,
    >> ETD3 ,
    >> ETA1 ,
    >> ETA2 ,
    >> ETA3 ,
    >> Unlading_port1 ,
    >> Unlading_port2 ,
    >> Unlading_port3 ,
    >> Unlad_port_ETA1 ,
    >> Unlad_port_ETA2 ,
    >> Unlad_port_ETA3 ,
    >> Final_dest1 ,
    >> Final_dest2 ,
    >> Final_dest3 ,
    >> service1 ,
    >> service2 ,
    >> service3 ,
    >> cost1 ,
    >> cost2 ,
    >> cost3 ,
    >> confirm1 ,
    >> confirm2 ,
    >> confirm3
    >> from inserted
    >>
    >>
    >>
    >>
    >>
    >>
    >>
    >>
    >
    >
    >.
    >
    pat Guest

  4. #4

    Default Re: Trigger - wont allow me to insert

    See, a little information goes a long way. I would have never gone down
    that road with what you originally posted<g>. Sounds to me like one or more
    of the columns in the AuditTrail2 table are smaller in size than the
    corresponding columns in the booking_up_revb table.

    --

    Andrew J. Kelly
    SQL Server MVP


    "pat" <Pmcel123cox.net> wrote in message
    news:002e01c34177$42825fe0$a301280aphx.gbl...
    > Andrew:
    >
    > The error I am receiving is as follows:
    >
    > "ODBC--Call Failed
    > [Microsoft] [odbc sql driver] string data, right
    > truncation (#0)"
    >
    > I am connecting to the database via ODBC - Acess 2000. I
    > have no problem connecting to the database and can do an
    > insert if the I drop the trigger. As soon as I implement
    > the trigger then I get the same errror.
    >
    > I can do a direct insert into the table.
    >
    > Thanks for your assistance.
    >
    > Pat
    >
    >
    > >-----Original Message-----
    > >Pat,
    > >
    > >Can you be a little more descriptive with what the actual
    > problem is? What
    > >is the error you get?
    > >
    > >--
    > >
    > >Andrew J. Kelly
    > >SQL Server MVP
    > >
    > >
    > >"pat" <Pmcel123cox.net> wrote in message
    > >news:490001c340ee$9074be70$a401280aphx.gbl...
    > >> Hello:
    > >>
    > >> I have the following trigger working fine - the problem
    > is
    > >> that I can do an insert into the table? What is the
    > >> problem.
    > >>
    > >>
    > >> CREATE TRIGGER [AuditInsert3] ON dbo.booking_up_revb
    > >> FOR insert
    > >> AS
    > >> INSERT INTO AuditTrail2
    > >> (TableName,booking_no,actionTaken, ActionUser,
    > >> ActionDate,Ocean,CNEE, Shipper,
    > >> Descrip ,
    > >> Org,
    > >> Dest,
    > >> Cont_20,
    > >> Cont_40,
    > >> Cont_HQ ,
    > >> Cont_45 ,
    > >> Cont_cbm,
    > >> PCS ,
    > >> GWT ,
    > >> Vol_wt ,
    > >> Hawb_Hbl ,
    > >> Container ,
    > >> Book_date ,
    > >> Comments ,
    > >> PO ,
    > >> CI ,
    > >> Carrier1 ,
    > >> Carrier2 ,
    > >> Carrier3 ,
    > >> Ves_Flt1 ,
    > >> Ves_Flt2,
    > >> Ves_Flt3 ,
    > >> clsg_date1,
    > >> clsg_date2 ,
    > >> clsg_date3 ,
    > >> ETD1 ,
    > >> ETD2 ,
    > >> ETD3 ,
    > >> ETA1 ,
    > >> ETA2 ,
    > >> ETA3 ,
    > >> Unlading_port1 ,
    > >> Unlading_port2 ,
    > >> Unlading_port3 ,
    > >> Unlad_port_ETA1 ,
    > >> Unlad_port_ETA2 ,
    > >> Unlad_port_ETA3 ,
    > >> Final_dest1 ,
    > >> Final_dest2 ,
    > >> Final_dest3 ,
    > >> service1 ,
    > >> service2 ,
    > >> service3 ,
    > >> cost1 ,
    > >> cost2 ,
    > >> cost3 ,
    > >> confirm1 ,
    > >> confirm2 ,
    > >> confirm3 )
    > >>
    > >> select 'booking_up_revb',booking_no,
    > >> 'I', user_name(), GetDate(), Ocean,CNEE, Shipper,
    > >> Descrip ,
    > >> Org,
    > >> Dest,
    > >> Cont_20,
    > >> Cont_40,
    > >> Cont_HQ ,
    > >> Cont_45 ,
    > >> Cont_cbm ,
    > >> PCS ,
    > >> GWT ,
    > >> Vol_wt ,
    > >> Hawb_Hbl ,
    > >> Container ,
    > >> Book_date ,
    > >> Comments ,
    > >> PO ,
    > >> CI ,
    > >> Carrier1 ,
    > >> Carrier2 ,
    > >> Carrier3 ,
    > >> Ves_Flt1 ,
    > >> Ves_Flt2,
    > >> Ves_Flt3 ,
    > >> clsg_date1,
    > >> clsg_date2 ,
    > >> clsg_date3 ,
    > >> ETD1 ,
    > >> ETD2 ,
    > >> ETD3 ,
    > >> ETA1 ,
    > >> ETA2 ,
    > >> ETA3 ,
    > >> Unlading_port1 ,
    > >> Unlading_port2 ,
    > >> Unlading_port3 ,
    > >> Unlad_port_ETA1 ,
    > >> Unlad_port_ETA2 ,
    > >> Unlad_port_ETA3 ,
    > >> Final_dest1 ,
    > >> Final_dest2 ,
    > >> Final_dest3 ,
    > >> service1 ,
    > >> service2 ,
    > >> service3 ,
    > >> cost1 ,
    > >> cost2 ,
    > >> cost3 ,
    > >> confirm1 ,
    > >> confirm2 ,
    > >> confirm3
    > >> from inserted
    > >>
    > >>
    > >>
    > >>
    > >>
    > >>
    > >>
    > >>
    > >
    > >
    > >.
    > >

    Andrew J. Kelly Guest

Similar Threads

  1. Replies: 3
    Last Post: September 30th, 09:24 PM
  2. Replies: 1
    Last Post: August 24th, 03:45 PM
  3. Before update or delete trigger to insert ?
    By Cindy Gold in forum IBM DB2
    Replies: 2
    Last Post: August 12th, 01:38 PM
  4. Have trigger supply value for NOT NULL column on insert
    By Ian Boyd in forum Microsoft SQL / MS SQL Server
    Replies: 2
    Last Post: July 3rd, 02:59 PM
  5. Trigger: Insert if not exists?
    By FC in forum Oracle Server
    Replies: 1
    Last Post: December 10th, 08:40 PM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139