Print Row count in Print Line

Hi, 
I have below code working fine, but at the moment even I have error it's print 'Congratulations! Database is Apend.'
However, I want to update this code, if error ocurrs then it must Print "Error" and when data is inserted then if should write the total number of rows created and PRINT 'Congratulations! Database is Apend.';
Any Help!!!!
/**********************************APEND************************/
if @TypeOfUpdate='Apend'
--exec('Insert into [' + @DestinationTable + '] ')
Begin 
exec('Insert into [' + @DestinationTable + '] select * from openrowset(''Microsoft.ACE.OLEDB.12.0'', ''Excel 12.0;HDR=YES;Database=' + @TABLENAME + ''', ' + ''' select * from '+@SourceSheet + ''')')
PRINT 'Congratulations! Database is Apend.';
END
looking for support!
thanks
SharePoint_Consultant_EMEA

/**********************************APEND************************/
if @TypeOfUpdate='Apend'
--exec('Insert into [' + @DestinationTable + '] ')
Begin Try
exec('Insert into [' + @DestinationTable + '] select * from openrowset(''Microsoft.ACE.OLEDB.12.0'', ''Excel 12.0;HDR=YES;Database=' + @TABLENAME + ''', ' + ''' select * from '+@SourceSheet + ''')')
Select @@RowCount
PRINT 'Congratulations! Database is Apend.';
End Try
Begin Catch
PRINT @@Error
End Catch
END
Shamas Saeed (if Post helpful please mark as Answer) http://shamas-saeed.blogspot.com

Similar Messages

  • How to print a report without row numbers or grid lines?

    Is there a way to print a Discoverer report without row numbers or grid lines?
    Thank you.
    Blake

    Hi Blake
    You're not doing anything wrong.
    The settings made when you use Tools | Options | Sheet are global settings that are only applied to new workbooks and worksheets going forwards. These have no impact on existing worksheets or even the one you currently have open. This is because Discoverer does not know whether your original worksheets were setup in a certain way deliberately as opposed to inheriting the global settings as they were at that time. What this also means, reading between the lines, is that these settings must then be stored within the worksheet itself, and this is exactly what happens.
    Thus, to edit an existing worksheet's settings you need to open the worksheet, right-click in the sheet and from the popup select either Format Table or Format Crosstab depending upon the type of worksheet you are working with. After making any necessary changes you will need to save or re-save the workbook in order for those settings to be remembered for the next time.
    Best wishes
    Michael

  • PLD Do Not Print Line if field== 'N'

    This may have been asked before but I can't find an answer. New to SAP & PLD.
    Working with PLD, I have a UDF field in table 'A/R Invoice - Rows' to indicate whether a line should be printed or not, 'U_PrintLine'. I am trying to get this within the Invoice form to be something like this:
    If F_300 == 'N' Then
    Do Not Print Line
    Else Print Line
    EndIf
    What is the easiest way of incorporating this with a 'Repetitive Area' of a PLD form?
    Thanks,

    I now realize that you want to suppress the whole line of data instead of a LINE. That would be more difficult.
    Basically, you may link all fields in the line with a conditional formula F_300 == F_301.
    Here F_300 is your UDF and F_301 = 'N'. The formula should be in another field say F_302.

  • How to print line item 2times in two different main window in Sap Script

    Hi,
    I am designing check printing form using Sap script. I need to print line items 2times in different 2main window.can yu pls explain  how print like this.
    JK

    i cud not get ur query..pls elaborate

  • Printing line items in next line smartforms

    how to print line item description in next line...
    suppose
    i have line item description as
    "this is description of line item"
    then i need to print as
    "this is"
    "description of line item"
    in two lines......
                so that no trunkation takes place please reply me ....

    Use offset
    v_text(20)
    in the second line use
    v_text+20(40)
    If this does not work
    then declare two more fileds
    and write the code
    v_text1 =  v_text(20)
    v_text2 = v_text+20(40)
    and print the new fields
    Reward points if useful,
    Regards,
    Nageswar

  • Get row count for different tables to the same line

    How can I get the row count for different tables in one line:
    SELECT count(A), count(B), count(C) from table tb_a A , tb_b B, tb_c C;
    Thanks!

    >
    Hi,
    How can I get the row count for different tables in one line:
    SELECT count(A), count(B), count(C) from table tb_a A , tb_b B, tb_c C;Something like this? One of the many uses for CTE's - Common Table Expressions - AKA
    subquery refactoring. Worth getting to know - very handy!
    with acount as
      select count(*) as counta from dual  -- put your table name here
    bcount as
      select count(*) as countb from dual  -- put your table name here
    ccount as
      select count(*) as countc from dual  -- put your table name here
    select a.counta, b.countb, c.countc from acount a, bcount b, ccount c;HTH,
    Paul...
    Edited by: Paulie on 25-Jul-2012 17:44

  • Color Laser 2605dn Prints Lines on Pictures

    Color Laser 2605dn Prints Lines on Pictures.
    Normally all txt prints ok but I cannot get rid of the horizontal and vertical lines ( if the image prints vertical) on all images that it prints.
    I rarely use this printer.  I have gone under settings/print quality and calibrated but it does not fix the problem.
    Please help.
    Thank you.
    JB

    Looks like a high voltage power supply issue with the black only.  Since the laser/scanner on this model uses 1 motor for 2 colors that would eliminate the laser/scanner.  Repair by a repair shop may cost more than the printer.  Only suggestion I can give to is do a google search for the service manual and download it.  Look for instructions for the removal of the high voltage ps and remove it and then put it back in.  There is always the possibility one of the connectors has become loose and is causing the issue.  Good Luck.

  • Printing Line by Line on Passbook Printer PR4

    Does anybody have any java code of printing utility tool to print line by line ({color:#ff6600}By using graphics{color}) on the printer? Is there any way to send graphics to be printed line by line to the printer by using java?
    Please help.
    Edited by: Dudley on Mar 13, 2009 1:55 AM

    Now lots of printer is usb port. So it can be done by using parallel printer command in usb printer. My problem now is print one line at a time and the paper still in the usb printer, and next time it will keep printing when I send some information to the usb printer.
    http://www.vitst.com
    Virry Test & Control
    LabVIEW Certified Developer

  • To print line item number in workflow message

    Hi Experts ,
    I want to print line item numbers of a sales order in a single workflow message .
    Can this be achieved ?
    I am generating WORKFLOW item , for a sales order , and want certain line item numbers to appear on the WORKFLOW message .
    Something like Sales Order XXXX  has line item 20  30 50 .
    Regards,
    Sunitha

    1. Enhance appropriate custom BOR Object.
    2. Create one Attribute which will gives you String output - Write program to this attribute to fill the string will all relevant texts for example : Line Items 10, 30, 54, 89.
    3.  Place this string in your work item description. So that your work item / email will carry this string under certain conditions.
    you many need to handled exception.
    Example -
    Dear User.
    Please Check the Sales Order 23456. The below line items went for Delivery block.
    Line Items 10, 30, 54, 89.
    Regards,
    Admin
    All the best,
    Vamsi

  • Since updating to 10.6.8 my Canon LBP3100B printer is only printing lines and no text??

    Hi there
    I hope someone is able to help me. I recently did a Software update to 10.6.8 and my Canon printer LBP3100B is now only printing lines & pictures (no text)
    I had a look on Canon's website and their newest driver is for 10.7 but i'm only on 10.6.8??
    Not sure what to do or if anyone else has had this problem.
    Why can't companies make their products more compatible with Macs? Sigh...

    deibu wrote:
    I have exactly the same problem since last weeks's 10.6.8 update, but with a Canon ip4500 printer.
    Unfortunately,  the v3.31 CAPT driver mentioned above is not for 10.6.8 or my printer, but thanks for trying Pahu.
    The CAPT v3.31 driver does work on 10.6.8 but the driver is for certain laser models of Canon printers and All In Ones, such as the LBP3100B that the OP has. I never said it was for the inkjets so I'm not sure how you thought that I did.
    deibu wrote:
    There doesn't seem to be any sign yet of Canon updating their 10.6.8 drivers, and the latest Apple update today didn't help either, although it apparently included a bug fix for other printer problems.
    The 10.6.7 and subsequent 10.6.8 updates did not introduce the 'no text printing' issue that the Canon laser devices experienced. If the iP4500 is not printing text then it may have simply run out of black ink. And note that this model has two black tanks. The PGI-5Bk which is for printing text and the CLI-8Bk which is used for photos. So run a nozzle test to see if all the colours are printing correctly.
    If both black tanks are working fine then try removing the printer from Print & Fax and adding it again. This can often help when printers stop working. Also, restarting the printer itself can often help resolve non printing issues.

  • JTextPane + Getting a row count..

    Hi,
    I've been looking for a solution to this, but can't find one already in the forum. there are some close .. but this is my problem..
    I'm looking to get the current row count of a JTextPane... I'm not looking to get the count of '\n'.... I want to take the wrapping into account .. so if I resize the JTextPane, the row counts will change accordingly.
    The reason I'm looking for this information is so I can set the size on the JTextPane so that it always shows the data.. but when it only has one line, I only want it to take up space for one line (the reason for this is I don't want vertical scrollbars appearing where they're not needed)
    I hope I have given enough information for someone to help me out..
    Thanks :)
    /Balmark

    Unfortunately WrappedPlainView's methods and inner classes are private so we can't access it normal way.
    This is an example of hack access to WrappedPlainView. In some cases it can throw access violation exception.
    best regards
    Stas
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.text.*;
    import java.lang.reflect.*;
    public class Test {
    JScrollPane scroll;
    JTextArea textArea=new JTextArea();
    public Test() throws Exception {
    JFrame frame=new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    textArea.setLineWrap(true);
    textArea.setText("12345 67890 12345 67890 12345 67890\n 12345 67890 12345 67890 12345 67890");
    scroll=new JScrollPane(textArea);
    frame.getContentPane().add(scroll);
    JButton b=new JButton("print line count");
    frame.getContentPane().add(b,BorderLayout.SOUTH);
    b.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
    System.err.println(textArea.getUI().getRootView(textArea).getView(0).getViewCount());
    WrappedPlainView pv=(WrappedPlainView)textArea.getUI().getRootView(textArea).getView(0);
    int lineCount=0;
    for(int i=0; i<pv.getViewCount(); i++) {
    View pvLine=pv.getView(i);
    try {
    Class cl=pvLine.getClass();
    Field f=cl.getDeclaredField("nlines");
    f.setAccessible(true);
    lineCount+=f.getInt(pvLine);
    /* Method methodLineCount=cl.getDeclaredMethod("calculateLineCount",null);
    methodLineCount.setAccessible(true);
    Object result=methodLineCount.invoke(pvLine,null);
    System.err.println("Line count="+result.toString());*/
    catch (Exception ex) {
    ex.printStackTrace();
    System.err.println("Line count="+lineCount);
    frame.setSize(200,200);
    frame.setLocationRelativeTo(null);
    frame.show();
    public static void main(String[] args) throws Exception {
    new Test();
    }

  • Java.sql.SQLException: while calculating row count: Unexpected exception :

    I am working with JDBC that is connected to MS Access 2003 file.
    I wrote and tested in MS Access following query and all it is working well. If I write this query and execute it is working well.
    pstm = DBConnect.prepareStatement(
    "SELECT Parameter.Name, Parameter.id FROM " +
    "(ParameterGroupMember INNER JOIN ApplicationReadsParameter ON " +
    "ParameterGroupMember.Member_Parameter_id = ApplicationReadsParameter.Parameter_id)" +
    "INNER JOIN Parameter ON ApplicationReadsParameter.Parameter_id = Parameter.id " +
    "WHERE (ParameterGroupMember.Group_Parameter_id=40) " +
    "UNION ALL SELECT Parameter.Name, Parameter.id FROM " +
    "Parameter INNER JOIN ApplicationReadsParameter ON " +
    "ApplicationReadsParameter.Parameter_id=Parameter.id WHERE (Parameter.id=40); ");
    rs = pstm.executeQuery();
    When I use code, that sets parameters in the statement it is firing following exception
    java.sql.SQLException: while calculating row count: Unexpected exception : 1
    at sun.jdbc.odbc.JdbcOdbcResultSet.parameterQuery(JdbcOdbcResultSet.java:6417)
    at sun.jdbc.odbc.JdbcOdbcResultSet.calculateRowCount(JdbcOdbcResultSet.java:6336)
    at sun.jdbc.odbc.JdbcOdbcResultSet.initialize(JdbcOdbcResultSet.java:155)
    at sun.jdbc.odbc.JdbcOdbcStatement.getResultSet(JdbcOdbcStatement.java:424)
    at sun.jdbc.odbc.JdbcOdbcPreparedStatement.executeQuery(JdbcOdbcPreparedStatement.java:93)
    pstm = DBConnect.prepareStatement(
    "SELECT Parameter.Name, Parameter.id FROM " +
    "(ParameterGroupMember INNER JOIN ApplicationReadsParameter ON " +
    "ParameterGroupMember.Member_Parameter_id = ApplicationReadsParameter.Parameter_id)" +
    "INNER JOIN Parameter ON ApplicationReadsParameter.Parameter_id = Parameter.id " +
    "WHERE (ParameterGroupMember.Group_Parameter_id=?) " +
    "UNION ALL SELECT Parameter.Name, Parameter.id FROM " +
    "Parameter INNER JOIN ApplicationReadsParameter ON " +
    "ApplicationReadsParameter.Parameter_id=Parameter.id WHERE (Parameter.id=?); ");
    pstm.setInt(1, 40);
    pstm.setInt(2, 40);
    rs = pstm.executeQuery();
    Further I found that the problem is with the setting of the second parameter in the statement. Is there different way how to set the second parameter if union is used?
    Thanks and regards,
    Jan

    Jan.Hv wrote:
    I am working with JDBC that is connected to MS Access 2003 file.
    Use code tags when you post code.
    I wrote and tested in MS Access following query and all it is working well. You mean it works in MS Access. Not that it works in java.
    >
    pstm = DBConnect.prepareStatement(
    "SELECT Parameter.Name, Parameter.id FROM " +
    "(ParameterGroupMember INNER JOIN ApplicationReadsParameter ON " +I STRONGLY suggest that rather than putting spaces at the end of each part put it at the beginning. It makes it much easier to get it right.
    I also suggest formatting the code. There are various ways.
            // Wrong
            String sql = "select x, y z "
                             + "from table1 t1, idtable idt"
                             + "where t1.tim=idt.tim "
                             +  "and t1.book = idt.book";
            // Right (spaces) - one way to format
            String sql = "select"
                             + "         x, y z"
                             + " from table1 t1, idtable idt"
                             + " where"
                             + "          t1.tim=idt.tim"
                             + "          and t1.book = idt.book";Your code is in fact missing a space. No idea if that is a problem or not.
    Remove the semicolon from the end.
    PRINT the sql before you use it, copy/paste and use that string in MS Access (replace the ?) to see if it work.
    Further I found that the problem is with the setting of the second parameter in the statement. Is there different way how to set the second parameter if union is used?The MS Access ODBC driver isn't really great for actually reporting errors correctly. So usually any error means something is wrong and it is up to you to figure out the exact problem.

  • How to count number of lines in a DMEE Tree

    Hi all,
    My requirement is that in my DMEE tree I have to count entries of line item data(FPAYP). Suppose for entry of FPAYH there are two entries in FPAYP then for first line of FPAYP 1 should be printed and for next line of FPAYP 2 should be printed and so on.
    Can anybody tell me how to do this?
    Regards,
    Azra.

    Well, if you know how to read one line with a Buffered reader, and you know how to keep reading lines until you run out, then all you have to to is initialize a counter to zero before you start reading, add 1 to it each time you read a line, and then examine its value when you're done.
    Try that, and post again if you get stuck.
    Just be careful how you construct your loop. "Off by one" errors are a common way to get bitten. It could happen if you count what you think is the last line, but you've actually already counted all the lines and you end up counting one extra for "there are no more lines".

  • How to return "Final Row Count" - where I have suppression filters etc

    I am building a data interface that outputs "trade records"
    Each report/file has a primary header record
    each report/file has a secondary header record for EACH TRADE
    each report/file has trade details per account under the secondary header record for EACH TRADE
    each report/file has a primary footer record, that shows the total row count of the resultant details
    the "Records" count in crystal is not what I need, as when the report prints/Exports, certain of those records are suppressed.
    I only need what "lands" in my txt file in respect to that final number of total rows of data
    Any suggestions are very greatly appreciated.  My search thru the forum did not return an answer that I could see.
    thank  you!
    Chris
    Edited by: CHRISTOPHER MAINARD on Jul 27, 2010 5:14 PM

    Thank  you  - I very much appreciate your response - but about the same time you posted - my experimentation and borrowing of like situation formulae seemed to solve it with some tweaking! 
    first I added this formula to count each "trade record"
    Whileprintingrecords;
    numbervar linecnt := linecnt +1
    then, in the "file footer" added this:
    tonumber({@totalRowCount})DistinctCount ({MoxyAllocation.OrderID})1
    thank you again for your input, I'm betting I'll find a use for that in the near future.
    CBM

  • Answers: total row count

    Ist it possible to print the total row count on the first or each page?
    Regards,
    Stefan

    I am relatively new to Answers. How do use row level count function?

  • GETTING ROW COUNTS OF ALL TABLES AT A TIME

    Is there any column in any Data dictionary table which gives the row counts for particular table..
    My scenario is...i need to get row counts of some 100 tables in our database...
    instead of doing select count(*) for each table....is there any way i can do it?
    similary How to get column counts for each table..in database .For example
    Employee table has 3 columns...empid,empname,deptno....i want count(empid),
    count(empname),count(deptno) ...is there any easy way for finding all column counts of each table in data base? is it possible?

    Why does "select count(mgr) from emp" return null and not 13?Good question ;)
    Seems that xml generation in principle can't handle »counting nulls«:
    SQL> select xmltype(cursor(select null c from dual)) x from dual
    X                                                
    <?xml version="1.0"?>                            
    <ROWSET>                                         
    <ROW>                                           
    </ROW>                                          
    </ROWSET>                                        
    1 row selected.
    SQL> select cursor(select count(null) c from dual) x from dual
    Cur

    1 row selected.
    SQL> select xmltype(cursor(select count(null) c from dual)) x from dual
    select xmltype(cursor(select count(null) c from dual)) x from dual
    Error at line 1
    ORA-31011: XML parsing failed
    ORA-19202: Error occurred in XML processing
    LPX-00229: input source is empty
    Error at line 0
    ORA-06512: at "SYS.XMLTYPE", line 0
    ORA-06512: at line 1
    but
    SQL> select xmltype(cursor(select count(1) c from dual)) x from dual
    X                                                
    <?xml version="1.0"?>                            
    <ROWSET>                                         
    <ROW>                                           
      <C>1</C>                                       
    </ROW>                                          
    </ROWSET>                                        
    1 row selected.Looks like a bug to me ...

Maybe you are looking for