Need help in speeding up an insert.

I am looking for ideas to speed up the following insert. It is reading a 6,500,000 row tables and is inserting 1,000,000 summed records into an empty table. The insert takes about 7 minutes, I would like to get it much faster. I have tried doing Direct Path /*+ APPEND */, and set the crbal_allCusts table to nologging and it made no difference in the time it took (It actually ran a little bit slower. I tried parallel query and it wasn't any faster. I might just have to accept that it is slow, but any ideas would be appreciated. I wouldn't write the package this way, but I inherited the code and need to speed it up, without re-writing the entire package.
CREATE TABLE crbal_allCusts
cust_cd VARCHAR2(10),
srt_cd VARCHAR2(3),
balance NUMBER(13,2),
procFlag VARCHAR2(1)
TABLESPACE TEMPTABS
STORAGE(INITIAL 600K NEXT 600K PCTINCREASE 0);
INSERT INTO crbal_allCusts
SELECT a.cust_cd, NULL,
SUM (decode (b.dc_cd, 'D', a.amt, -a.amt)) balance,
'N'
FROM ar_trn_tp b, ar_trn a
WHERE b.trn_tp_cd=a.trn_tp_cd
AND a.stat_cd IN ('P','T')
AND a.ar_tp ='O'
AND a.co_cd = 'RAY'
GROUP BY a.cust_cd;
COMMIT;
CREATE INDEX crall_idx ON crbal_allCusts (cust_cd);
..... processing using new table.

rem
rem $Header: utlxplan.sql big_dev/0 11-aug-95.14:02:45 achaudhr Exp $ xplainpl.sql
rem
Rem Copyright (c) 1988, 1995, 1996, 1998 by Oracle Corporation
Rem NAME
REM    UTLXPLAN.SQL
Rem  FUNCTION
Rem  NOTES
Rem  MODIFIED
Rem     mzait      02/19/98 -  add distribution method column
Rem     ddas       05/17/96 -  change search_columns to number
Rem     achaudhr   07/23/95 -  PTI: Add columns partition_{start, stop, id}
Rem     glumpkin   08/25/94 -  new optimizer fields
Rem     jcohen     11/05/93 -  merge changes from branch 1.1.710.1 - 9/24
Rem     jcohen     09/24/93 - #163783 add optimizer column
Rem     glumpkin   10/25/92 -  Renamed from XPLAINPL.SQL
Rem     jcohen     05/22/92 - #79645 - set node width to 128 (M_XDBI in gendef)
Rem     rlim       04/29/91 -         change char to varchar2
Rem   Peeler     10/19/88 - Creation
Rem
Rem This is the format for the table that is used by the EXPLAIN PLAN
Rem statement.  The explain statement requires the presence of this
Rem table in order to store the descriptions of the row sources.
create table PLAN_TABLE (
        statement_id    varchar2(30),
        timestamp       date,
        remarks         varchar2(80),
        operation       varchar2(30),
        options         varchar2(30),
        object_node     varchar2(128),
        object_owner    varchar2(30),
        object_name     varchar2(30),
        object_instance numeric,
        object_type     varchar2(30),
        optimizer       varchar2(255),
        search_columns  number,
        id              numeric,
        parent_id       numeric,
        position        numeric,
        cost            numeric,
        cardinality     numeric,
        bytes           numeric,
        other_tag       varchar2(255),
        partition_start varchar2(255),
        partition_stop  varchar2(255),
        partition_id    numeric,
        other           long,
        distribution    varchar2(30));

Similar Messages

  • I need help with speed of deleting do noy know how to fix

    am not very good at this, need help, deleting button is so slow it is not working as before

    Check your mails are SYNCed properly or not. otherwise reSYNC your emails and check it out.
    Try in safemode also
    *https://support.mozilla.org/en-US/kb/safe-mode

  • Idiot needs help increasing speed of motion template "blizzard".

    I need to overlay some snow over an existing shot done on exterior location with snow machines.
    I've found the "blizzard" setup in motion and, since I really don't know motion at all, I want to ask if a kind expert out there can help me simply on how to speed it up, so that the snow falls/moves faster.
    Please understand that I can't learn "Motion" in order to do this one effect and I'd appreciate it if you guys and gals would not berate me for being so lazy as to ask for your help on this one issue.
    Many thanks if you can and will help,
    Best wishes,
    An idiot,
    Harry

    This is just an FYI on forum use - Please click on the or buttons over posts as appropriate - you not only reward those who answer your questions, but point future readers to where you found your answers...
    Patrick

  • Need help for "From concatenate string insert to mysql table"

    Well, most of this problem is a question about SQL syntax. In the VALUES clause you put a comma delimited list of the values to go into the new record. You insert one record at a time. How are the columns defined? Have you done any study on basic SQL?
    Mike...

    i nid to insert values from concatenate string into mysql with using LabSQL, but the result come out from conatenate string is like " 2015-07-08 00:00:00 38.933235E-3" , a logged data of "Date Time Wind Speed(m/s). i nid to put these 3 values into 3 different column in mysql which is Date Time and Wind Speed. How can i pick Date to put inside Date's column, Time into Time's column and Wind Speed into Wind Speed's column in mysql ?
    What i do is
    INSERT INTO wind_speed_data (Date, Time, Wind_Speed) The space in Wind Speed can i put a _ in between Wind Speed? without _ and just put Wind Speed it shows errors.
    VALUES( i have no idea wat to key in at this part ) <--- nid help !
    The Mysql table. Date Time Wind Speed
    The result from concatenate string. Have to insert into mysql.
    My labview program.
    The error i facing.
     

  • Need help with speed remapping

    So here is my question. (check pic below to see timeline)
    I'm working on a timeline and I have a clip somewhere in the middle of this timeline. Now I've put the two markers which close off the area of the clip that I want in slow-motion. And then I drag the rubberband now to 50%. This causes the clip to obviously become longer.
    But the problem is that it doesn't push the clip that comes afterwards, it just sort of submerges and I lose a part of the clip that I put into slow-mo.
    http://gyazo.com/0cce5ab07e22897f21a25e3308a9cbb5.png Here's a picture of my timeline.
    So my question is how can I make it so that the clip after is pushed forward automatically?
    I know how to fix this problem with some dragging and pulling, but I want to become as efficient as I can and don't get into any bad habits.
    Thanks!

    If all you want to do is simply slow down or speed up a clip, use the Speed/Duration settings--it's probably the simplest way to induce a speed change. This is a constant speed change, which you can also do with Time Remapping--which is what I think you've been doing.
    The benefit of Time Remapping is that it allows for variable speed changes within a single instance of a clip. Say for example you want your clip to start at 100% speed, slow down immediately to 25%, and then speed up immediately to 200%. You can do this with Speed/Duration, simply by razoring the clip at the specific points where you want the speed change to occur, and then altering the Speed/Duration setting for that instance of the clip. With Time Remapping, not only can you do this without having to chop up the clip, but you can also create "ramps" from one speed to another--hence the variable speed aspect. You can even freeze a clip or reverse it, all without editing the clip into smaller pieces. This can result in a much smoother effect, but it might not always be what you're after. Time Remapping does have a bit of a learning curve, but it really is the more powerful option of the two. You just have to decide which is better for your purposes.
    An additional benefit, and I might be wrong on this, but I believe that using the Time Remapping function results in (theoretically) a higher quality speed change effect due to a different algorithm or some-such. It uses some different techniques to generate the interpolated frames created in a speed change, that should look smoother than if they were done with the Speed/Duration command.
    Hope the helps a bit.

  • Need help with speed dial on Continuum

    I've read the book which isn't very helpful for a new user. Can anyone help me set up speed dial on the Continuum?

    Hi jackiejunque,
    Welcome to the wonderful world of Smartphones! We do offer in-store or online Smartphone Workshops to help customers get acclimated with their devices.  Additionally, here are the steps on how to add or remove speed dials:
    Add Speed dial
    From the main screen tap Phone
    Tap Menu
    Tap Speed dial settings
    Remove Speed dial
    From the main screen tap Phone
    Tap Menu
    Tap Speed dial settings
    Tap Menu
    Tap Remove
    Select the contact to remove from speed dials and press the "Red X" icon to remove
    I hope this information is helpful as you begin to explore your new device.  Please let me know if you have any additional questions.
    Thank you,

  • Broadband upgrade, need help with speed please

    Hi all,
    I recently upgraded from a very old broadband package with an old router from the 1960's to the 'upto 20meg' service, with the bloke on the phone advising we should receive about 17meg as we are close to the exchange (Worcester Park, Surrey).  So when the new kit arrived the speed jumped from 2megs to about 4ish and it's now settled on about 5 after 10 days.
    I've posted the stats below as i'm after some advice really because I can't make sense of it.  Am I missing something here or should I be getting faster speeds?
    Cheers

    Hi welcometo the forum
    You appear to have a stable connection however your connection speed is low for your line attenuation are you connected to the master socket ? Or an extension if you can connect to the test socket Located at the rear of the removable front plate of the master socket and recheck the hub stats and speedtest this wil eliminate any faults with your internal wiring also are you connecting the hub to your pc by wireless or ethernet cable if wireless could you try connecting by cable and again post the speed test results this will eliminate any speed losses due to wireless interference Please try these first then we can advise further
    If you want to say thanks for a helpful answer,please click on the Ratings star on the left-hand side If the reply answers your question then please mark as ’Mark as Accepted Solution’

  • Need help- filming soccer - want to insert marker on player!

    Hi- I am filming soccer games and want to highlight a player by insecting some form of marker on the player so a viewer identify them from a distance during the video
    How can I do this? I am using Adobe Elements 4.0 on vista. THX

    it says "audio code missing" and won't play
    My guess would be that that message should read "Audio CODEC." This is an encoding/decoding plug-in for your player. I do not remember exactly which file format and CODEC's (Audio and Video) Curt's tutorials use, but will go check now. For Curt's site, you do NOT need to subscribe to anything. On Muvipix, you can just sign-up, and then buy various things, or can subscribe and download EVERYTHING. Years ago, I did the "math," and instantly subscribed.
    As I mentioned above, there are three Keyframeing tutorials on Muvipix. They were written and produced by Steve Grisetti and Chuck Engels. I do not recall if they are free, for just the sign-up, or if they are only free to subscribers.
    I have to admit that I am anything but a Keyframe guru in PrElements. I use it in PrPro and AfterEffects all of the time. I would not be without it. Even a lot of my Transitions are done by Keyframing Effects, rather than the standard Transitions. However, in PrE, if I had to do Keyframing, I'd head to Muvipix and get Steve and Chuck's tutorials, just to see the differences in PrE, from my editing program, PrPro. I know the latter very well, but the former, not so well.
    Heck, when answering PrE questions, I normally have to have that program open on my computer, just to check out my memory. The two Premieres are similar, though different enough to keep me on my toes!
    I'll be back with the data on Curt's tutorials.
    In the meantime, you might also want to get two additional players, VLC Player and MediaPlayer Classic. Both are freeware, and contain most common CODEC's, so they play AV files natively, where Windows Media Player and QuickTime will often struggle with additional CODEC's.
    Back in a minute,
    Hunt

  • Need help, Fluctuant speed in my network

    I have and old Linksys WRT54G for my Imac power PC. The rooter is located in the basement and the computer is on the second floor. The signal vary a lot and it even freeze sometimes. At Best Buy I met the apple specialist, who sold me and Airport Express, telling me it woud enhance my network. I installed it with airport utility, follow all the steps but it doesn't connect in my network, the yellow light is still flashing and when i get back to airport utility it doesn't see the airport Express, I have to reset it each time and reconfigure it but that still doesn't work.
    Anyone can help me?
    Thank you in advance

    If your goal is to extend the wireless range of your Linksys router with the new 802.11n AirPort Express Base Station (AXn), then the two router must be configured for a Wireless Distribution System (WDS). Fortunately, your Linksys router is one of the very few that are WDS-compatible with the AirPorts.
    Please check out the following links to see how others have been successful doing so:
    o Apple Discussions: Topic : How to extend your Linksys WRT54G with AE
    o Apple Discussions: Topic : kair: Linksys WRT54G and WDS
    o Linksys WRT54G, Airport Express, and WDS

  • Need help with "The disk you inserted is not readable by this computer."

    I have an external disk that I have not used in a while (an older G tech with FW800 ports). Recently I plugged it in and my 2008 iMac (10.8.5) reported, "The disk you inserted is not readable by this computer."
    If I leave the external disk in, my iMac won't get past the white screen with the Apple logo on boot up.
    With Disk Arbitrator, Disk Utility sees it but reports that it has zero bytes and the Verify and repair disk options are greyed out. DiskWarrior does not see it and if I start Disk Arbitrator up first and then Disk Warrior, everything but the cursor freezes and I have to hold the power button down to restart the computer.
    I tried listening to the disk on start up and it makes a fan-like noise and has a slight vibration but I don't think I hear the click-ity click noise of the head reading the drive.
    Any tips on trying to salvage its contents?

    You may have ordered what you though was exactly the same thing as what you had, but the interface electronics in it are apparently NOT the same, rendering the drive unreadable unless you want to re-partition and re-format it first (wiping all the data in the process).

  • Need help for a procedure

    All,
    I have a function and a procedure in a package. The function is called by the procedure. The function returns multiple records with multiple fields in a table type. The procedure uses those values to update the database. My question is how can I get those values to update database. Need sample of code.
    beloew is my package:
    CREATE OR REPLACE PACKAGE "test_record2" as
    type V_testre is record (
    USER_ID NUMBER,
    B_ID NUMBER,
    A_ID NUMBER);
    Type T_userInfo is table of user_Access %rowtype
    index by binary_integer;
    procedure get_info(userid in number);
    function P_GetProfile(userid in number) return T_userInfo;
    end;/
    CREATE OR REPLACE PACKAGE BODY "test_record2" as
    procedure get_info(userid in number) as
    get_access T_userInfo;
    v_userid number;
    begin
    get_access := P_GetProfile(v_userid);
    --How to get the values from get_access to do the insert.
    --Need help here!!!
    --insert into test_access values get_access
    end;
    -- test table
    function P_GetProfile(userid in number) return T_userInfo is
    profile_info T_userInfo;
    CURSOR c1 IS
              select * from user_Access          
    where USER_ID = userid;
    BEGIN
         OPEN c1;
         FETCH c1 BULK COLLECT INTO profile_info;
         return profile_info;
    END;
    End;
    --create the table
    CREATE TABLE user_access (user_id NUMBER, m_id NUMBER, n_id NUMBER);
    INSERT INTO user_access VALUES (1, 11, 111);
    INSERT INTO user_access VALUES (1, 22, 222);
    INSERT INTO user_access VALUES (1, 33, 333);
    INSERT INTO user_access VALUES (2, 11, 111);
    INSERT INTO user_access VALUES (2, 22, 222);
    INSERT INTO user_access VALUES (2, 33, 333);

    CALL is not valid PL/SQL. (In fact, it's only valid in OLAP).
    You want either...
    BEGIN
        test_record2.get_info(1);
    END;
    /...or (in SQL*Plus)....
    EXEC test_record2.get_info(1)I commend the documentation to you.
    Cheers, APC

  • Need help with INSERT and WITH clause

    I wrote sql statement which correctly work, but how i use this statment with INSERT query? NEED HELP. when i wrote insert i see error "ORA 32034: unsupported use of with clause"
    with t1 as(
    select a.budat,a.monat as period,b.vtweg,
    c.gjahr,c.buzei,c.shkzg,c.hkont, c.prctr,
    c.wrbtr,
    c.matnr,
    c.menge,
    a.monat,
    c.zuonr
    from ldw_v1.BKPF a,ldw_v1.vbrk b, ldw_v1.bseg c
    where a.AWTYP='VBRK' and a.BLART='RV' and a.BUKRS='8431' and a.awkey=b.vbeln
    and a.bukrs=c.bukrs and a.belnr=c.belnr and a.gjahr=c.gjahr and c.koart='D'
    and c.ktosl is null and c.gsber='4466' and a.gjahr>='2011' and b.vtweg='01'
    ,t2 as(
    select a.BUKRS,a.BELNR, a.GJAHR,t1.vtweg,t1.budat,t1.monat from t1, ldw_v1.bkpf a
    where t1.zuonr=a.xblnr and a.blart='WL' and bukrs='8431'
    ,tcogs as (
    select t2.budat,t2.monat,t2.vtweg, bseg.gjahr,bseg.hkont,bseg.prctr,
    sum(bseg.wrbtr) as COGS,bseg.matnr,bseg.kunnr,sum(bseg.menge) as QUANTITY
    from t2, ldw_v1.bseg
    where t2.bukrs=bseg.bukrs and t2.belnr=bseg.BELNR and t2.gjahr=bseg.gjahr and BSEG.KOART='S'
    group by t2.budat,t2.monat,t2.vtweg, bseg.gjahr,bseg.hkont,bseg.prctr,
    bseg.matnr,bseg.kunnr
    ,t3 as
    select a.budat,a.monat,b.vtweg,
    c.gjahr,c.buzei,c.shkzg,c.hkont, c.prctr,
    case when c.shkzg='S' then c.wrbtr*(-1)
    else c.wrbtr end as NTS,
    c.matnr,c.kunnr,
    c.menge*(-1) as Quantity
    from ldw_v1.BKPF a,ldw_v1.vbrk b, ldw_v1.bseg c
    where a.AWTYP='VBRK' and a.BLART='RV' and a.BUKRS='8431' and a.awkey=b.vbeln
    and a.bukrs=c.bukrs and a.belnr=c.belnr and a.gjahr=c.gjahr and c.koart='S'
    and c.ktosl is null and c.gsber='4466' and a.gjahr>='2011' and b.vtweg='01'
    ,trevenue as (
    select t3.budat,t3.monat,t3.vtweg, t3.gjahr,t3.hkont,t3.prctr,
    sum(t3.NTS) as NTS,t3.matnr,t3.kunnr,sum(t3.QUANTITY) as QUANTITY
    from t3
    group by t3.budat,t3.monat,t3.vtweg, t3.gjahr,t3.hkont,t3.prctr,t3.matnr,t3.kunnr
    select NVL(tr.budat,tc.budat) as budat,
    NVL(tr.monat,tc.monat) as monat,
    NVL(tr.vtweg,tc.vtweg) as vtweg,
    NVL(tr.gjahr, tc.gjahr) as gjahr,
    tr.hkont as NTS_hkont,
    tc.hkont as COGS_hkont,
    NVL(tr.prctr,tc.prctr) as prctr,
    NVL(tr.MATNR, tc.MATNR) as matnr,
    NVL(tr.kunnr, tc.kunnr) as kunnr,
    NVL(tr.Quantity, tc.Quantity) as Quantity,
    tr.NTS as NTS,
    tc.COGS as COGS
    from trevenue TR full outer join tcogs TC
    on TR.BUDAT=TC.BUDAT and TR.MONAT=TC.MONAT and TR.GJAHR=TC.GJAHR
    and TR.MATNR=TC.MATNR and TR.KUNNR=TC.KUNNR and TR.QUANTITY=TC.QUANTITY
    and TR.VTWEG=TC.VTWEG and TR.PRCTR=TC.PRCTR
    Edited by: user13566113 on 25.03.2011 5:26

    Without seeing what you tried it is hard to say what you did wrong, but this is how it would work
    SQL> create table t ( n number );
    Table created.
    SQL> insert into t
      2  with test_data as
      3    (select 1 x from dual union all
      4     select 2 x from dual union all
      5     select 3 x from dual union all
      6     select 4 x from dual)
      7  select x from test_data;
    4 rows created.
    SQL>

  • I need help in getting VZ to fix my DSL speed - they refused to fix it two times

    I live in E. Boston and opened a trouble ticket on 8-26-13 for slow internet speed. Ticket number was {edited for privacy}Agreement was made for a tech to arrive on the 28th between 1 and 5 PM. Somebody showed at my door on the 28th at 11:15AM. He immediately said that he had already done some outside checking and there was a problem outside of my home. I showed him my slow connection speed and he left saying he would be back later. I saw him on poles around my home and he called later saying he needed help from his office and would let me know the status by 3PM or so. I never heard from him again. I continued to check the ticket status and it was open.
    On Friday, Aug. 30th, about 9:15AM, I received a call from a VZ telephone tech named Rich. He again did some outside checking and came into my home. I showed him my slow internet speed and he went back outside after telling me that he had no test equipment but he would go back outside to see what he could do and call his manager since he was not a VZ internet tech. He came back a little later and told me that he did all that he could do and asked me to run my tests again. I did so in front of the tech and the speed was at least 30% slower than it is supposed to be. The VZ telephone tech said he would call for help from his office to send a tech with proper test equipment and he left. A number of hours passed and the VZ telephone tech called and told me HIS MANAGER TOLD HIM TO CLOSE THE TICKET AND TO SEND THE MANAGER THE INFORMATION.
    I immediately asked for and got the name and office of the manager that did this and I have it. I will hold off posting it for a couple of days but then I will let everyone know how this Verizon manager performs as well as who he is. I wonder how his superiors will like that?
    Does anyone have any suggestions who in Verizon cares enough to get my problem resolved? I have already filed a complaint with the AGO today. Verizon does this to keep their numbers from being respective of what they really are as well as knowing that customers do not want to again walk through all of the crap in opening a trouble ticket in India. I have been in telecom for 45 years and this is just disgraceful. It is about time VZ developed some integrity.

    Your issue has been escalated to a Verizon agent. Before the agent can begin assisting you, they will need to collect further information from you.Please go to your profile page for the forum, and look in the middle, right at the top where you will find an area titled "My Support Cases". You can reach your profile page by clicking on your name beside your post, or at the top left of this page underneath the title of the board.
    Under “My Support Cases” you will find a link to the private board where you and the agent may exchange information. This should be checked on a frequent basis as the agent may be waiting for information from you before they can proceed with any actions. Please keep all correspondence regarding your issue in the private support portal.

  • Need Help in Inserting first ever record

    I need help in inserting my first ever record from an OAF page.
    I've created an AM 'MasterAM', added 'MasterVO' to it. Created a Page CreatePG which has a submit button, id = Apply
    Below is processRequest of CreateCo
    public void processRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processRequest(pageContext, webBean);
    OAApplicationModule am = pageContext.getApplicationModule(webBean);
    if (!pageContext.isFormSubmission()) {
    am.invokeMethod("createRecord", null);
    and below is processFormRequest
    public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processFormRequest(pageContext, webBean);
    OAApplicationModule am = pageContext.getApplicationModule(webBean);
    if (pageContext.getParameter("Apply") != null)
    OAViewObject vo = (OAViewObject)am.findViewObject("MasterVO1");
    am.invokeMethod("apply");
    pageContext.forwardImmediately("OA.jsp?page=/abcd/oracle/apps/per/selfservice/xxdemo/webui/CreatePG",
    null,
    OAWebBeanConstants.KEEP_MENU_CONTEXT,
    null,
    null,
    true,
    OAWebBeanConstants.ADD_BREAD_CRUMB_NO);
    Below are 'createRecord' and 'apply' in MasterAMImpl
    public void createRecord(){
    OAViewObject vo = (OAViewObject)getMasterVO1();
    if (!vo.isPreparedForExecution()) {
    vo.executeQuery();
    Row row = vo.createRow();
    vo.insertRow(row);
    row.setNewRowState(Row.STATUS_INITIALIZED);
    public void apply() {
    getTransaction().commit();
    When I run the page, it opens and I try to enter some data and press Apply. it does not insert into the table.
    Could anyone help me out.
    My jdeveloper version is 10.1.3.3.0.3

    I am facing the same issue.
    rows get inserted into the tbale, but only whol columns have the data.
    all the attributes are correctly mapped to view instance and view attribute.
    My VO has 1 EO and , i have joined another table to get desctriptions of the field.
    could that be the problem ?
    ex :
    select item , desc
    from t , master
    where t.cola=master.colb
    table t is the custom table I want the data to go in. but only who columns appear after commiting.
    any clues ?

  • Print insert result to a printer in TSQL trigger after insert - Need help.

    Hi,
    I am trying to print a record to a printer whenever a new record is inserted into a table called PrintTickets, using TSQL trigger for insert. 
    Is it possible to print a new inserted record to a printer?
    Here is the trigger tsql statement: 
    ALTER TRIGGER [dbo].[PrintDeal]
    ON [dbo].[PrintTickets]
    AFTER INSERT
    AS
    declare @Id numeric(18,0)
    ,@DealId char(15)
    ,@ValueDatePeriod1Currency1 datetime
    ,@Bank1Name char(56)
    ,@Currency1 char(3)
    ,@Currency2 char(3)
    ,@PaymentInstructionP1C1 char(80)
    ,@DealerId char(6)
    ,@DealVolumeCurrency1 float
    ,@CalVolumeP1C2 float
    ,@ExchangeRatePeriod1 float
    declare @tmp table
    Id numeric(18,0)
    ,DealId char(15)
    ,ValueDatePeriod1Currency1 datetime
    ,Bank1Name char(56)
    ,Currency1 char(3)
    ,Currency2 char(3)
    ,PaymentInstructionP1C1 char(80)
    ,DealerId char(6)
    ,DealVolumeCurrency1 float
    ,CalVolumeP1C2 float
    ,ExchangeRatePeriod1 float
    PRIMARY KEY (Id)
    BEGIN
    -- SET NOCOUNT ON added to prevent extra result sets from
    -- interfering with SELECT statements.
    SET NOCOUNT ON;
    -- Insert statements for trigger here
    insert @tmp
    select
    Id
    , DealId
    , ValueDatePeriod1Currency1
    , Bank1Name
    , Currency1
    , Currency2
    , PaymentInstructionP1C1
    , DealerId
    , DealVolumeCurrency1
    , CalVolumeP1C2
    , ExchangeRatePeriod1
    FROM dbo.PrintTickets
    WHERE ID=@@IDENTITY
    select @Id=Id
    ,@DealId=DealId
    ,@ValueDatePeriod1Currency1=ValueDatePeriod1Currency1
    ,@Bank1Name=Bank1Name
    ,@Currency1=Currency1
    ,@Currency2=Currency2
    ,@PaymentInstructionP1C1=PaymentInstructionP1C1
    ,@DealerId=DealerId
    ,@DealVolumeCurrency1=DealVolumeCurrency1
    ,@CalVolumeP1C2=CalVolumeP1C2
    ,@ExchangeRatePeriod1=ExchangeRatePeriod1
    from @tmp
    -- Code to print to a physical printer if possible
    END
    The table is called PrintTickets and it contains the following columns: 
    Id numeric(18,0)
    ,DealId char(15)
    ,ValueDatePeriod1Currency1 datetime
    ,Bank1Name char(56)
    ,Currency1 char(3)
    ,Currency2 char(3)
    ,PaymentInstructionP1C1 char(80)
    ,DealerId char(6)
    ,DealVolumeCurrency1 float
    ,CalVolumeP1C2 float
    ,ExchangeRatePeriod1 float
    PRIMARY KEY (Id)
    The dummy records that I am inserting for testing the results in csv format:
    Id,DealId,ValueDatePeriod1Currency1,Bank1Name,Currency1,Currency2,PaymentInstructionP1C1,DealerId,DealVolumeCurrency1,CalVolumeP1C2,ExchangeRatePeriod1
    696,XXX#33111 ,2014-03-04 00:00:00.000,HSBC ,USD,EUR,XXXXXXXXXXXXXXXXXXXXXXX ,MAT ,342342,87987,0.3123
    697,XXX#33113 ,2014-03-04 00:00:00.000,USB ,EUR,USD,9999999999999999999999,ZXY,2334243,32213,0.3245
    698,XXX#33114 ,2014-03-03 00:00:00.000,SWISS BANK ,CHF,USD,99999999999999900000,XYZ ,32423424,342,0.83432
    699,XXX#33115 ,2014-03-03 00:00:00.000,UK BANK ,USD,PND,XXXXXXXXXXXXXXXXXXXXXXX ,ABC,9809808,0,0.0349
    700,XXX#33116 ,2014-03-04 00:00:00.000,USCF BANK ,XXX,XXX,XXXXXXXXXXXXXXXXXXXXXXX ,ABC,89798797,756756,0.734
    I appreciate any help.
    Thanks in advance.

    Is it possible to print a new inserted record to a printer?
    From SQL Server?
    The task of SQL Server is to manage large of data effciently. It is not a general programming environment. It could possibly be done with a CLR procedure that that talks to the printer, but it is not the correct solution.
    A possible design could be to post a message on a Service Broker queue, and then the printing server would poll the queue and print the ticket.
    By the way, there are more flaws in your trigger. To find the inserted rows, you need to query the virtual table "inserted" which holds a copy of these rows. Furthermore, since a trigger fires once per statement, the trigger must handle the fact
    that multiple rows are inserted.
    Erland Sommarskog, SQL Server MVP, [email protected]

Maybe you are looking for

  • My itunes store won't open and i don't know what to do.

    please help!

  • Problem with NotificationService

    I am using BPEL 10.1.2.0.0 (fresh install) and created a simple User Task to test out email notification. This bpel instance uses LDAP / OID for authentication, and I have modified the ns_emails.xml to add the correct EmailAccount information for Out

  • Property executeInBackground not found on flash.desktop.nativeExtensions on iOS

    Hi, I'm unable to set this property in my iOS app as per the documentation. I'm on AIR version 3.3.0.3650 but cannot read or write to this property (though it does appear in code completion within Flash Builder. How to I get access to it? Thanks

  • Nokia N8 SMS outbox message

    I have a SMS message in the outbox that I can't delete, The status says that it will be sent later, It does not help to press the message and keep it pressed Solved! Go to Solution.

  • How to skin the ToggleButtonBar

    I'm trying to skin the buttons in the ToggleButtonBar but I'm having a hard time figuring this one out. I used the style on a Button and it worked fine. Can someone see what's wrong? Here's what I have by way of code: MXML: <mx:ApplicationControlBar