Retain Leading Zeroes

Hi,
I have a column value 0008-1913 in text file. When i dump this into a database in SQL server, the value becomes Aug-13.
I am dumping from a text file to SQL using a query transformation. No script or function involved, just mapping the output schema with the input schema.
How can i retain the same value in SQL?
Appreciate your help.
Arun

Problem rectified.
Arun

Similar Messages

  • Retain Leading Zero in CSV

    Hi,
    We are exporting the output in CSV format but CSV is not showing leading zeros.
    For example -  if the value is 0002 then it appears as 2 in CSV.
    Is there any method or trick to retain leading zeros.
    Although, this can be done through excel macro(after the file is opened) but for that manual intervention is required.
    Is there any way to run excel macro through web page ? I mean if we could automate the procedure of running macro.
    so that user just clicks on the button "Export to CSV" on web page and he gets the output in Excel with leading zeros retained.
    Regards,
    Anil

    Hi Jeremy,
    Although i am building a string in BLS and writing it into a csv file
    but I tried to test your statement by simulating with test data
    For one column of "VARCHAR2" datatype, the value is '0002'
    when i test the query results with text/xml output, the SQLDataType="12"
    and the value is 0002
    but when i test the query results with text/csv output, the value is 2.
    Regards,
    Anil

  • Retaining leading zero after sum operation

    I have a variable g = 00000005. Now when I am adding g = g + 1.
    The result is coming 6 but without leading zeroes.How could I retain leading zero after sum operation.

    Hi Priya,
    Declare the g as type N.. then do sum.. okay..
    ex :
    data : d(7) type n value '0000005'.
      g = g + 1.
    write : g.
    output is : 0000006.
    Raghunath.S

  • To retain Leading zeros

    Hi,
    I have  a table control .In which for a field (char or numc) the leading zeros are not retained. Pls help what should be done to retain the same.
    Thanks in advance
    Ram

    Hi Prabha,
    See this code,
    data : a(8) type n.
    a = '2345'.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
      EXPORTING
        input         = a
    IMPORTING
       OUTPUT        =  a  .
    write :/ a.
    The output will be 00002345.
    This function module places zeros if the input variable length is greater than occupied. Here a is having 8 char length and have only 4 chars so the first 4 spaces gets filled with zeros.
    Hope u got it.

  • How to retain leading zeros in module pool screen

    Hi experts,
    I have a ztable field of type NUMC4 being displayed on a module pool screen, the value in the field is '0001', but on the screen it displays value as '1' (without leading zeros), When I save the record, Even in the databse it stores as '1'.
    But I have checked in debugging the field always contains '0001' in the program execution and I have also used 'CONVERSION_EXIT_ALPHA_INPUT' in the PBO but no use.
    Pls suggest.
    Thanks,
    Deepak

    Check the screen attributes for the field. There is an option to show leading zeroes.
    edit.
    And how did you see it was stored a 1 and not 0001? Using SE16N? Mind you: with SE16N conversion-exits are executed automatically thus showing 0001 as 1.
    To make sure: double click on the record in SE16N and look if it's still 1 and not 0001.

  • How to retain leading zeros in an excel sheet

    Hi,
    In my application I need to export the response from a struts action class to an excel sheet. I have done the coding but while exporting to the excel , the leading zeros are getting truncated. If the value is '01' it is displayed as '1' only.
                    response.setContentType("application/text");
                             response.setHeader("Content-disposition",
                                       "Attachment;filename=\"export.xls\"");
                             response.getOutputStream().println(data);
                             response.getOutputStream().flush();This is the code which I am using to export all the data to the excel.Here the variable data is a String .
    Kindly help on this issue.
    Thanks in advance...
    Edited by: 2569 on Jan 10, 2008 8:59 PM
    Edited by: 2569 on Jan 10, 2008 9:51 PM

    2569 wrote:
    I tried that way also, but its not working. I have defined all the values as strings only. Thanks for ur replyWhich API are you using to write excel files? You can try to surround the numeric string value with singlequotes (or escaped doublequotes)String numericString = "'01'";so that Excel interprets it as string.

  • Preserve Leading Zeros in SQL export to TXT

    I need to export accounting data from SQL to a series of TXT files, with a "ServiceCode" of 02. I cannot get the
    leading zero to stick.
    Here is the section of the SQL stored procedure that pulls the serviceCode of “02.”
    IF @serviceCode =
    '02'
    BEGIN
    SELECT @total =
    COALESCE(SUM(Price),0),
    @itemCount = COALESCE(SUM(ItemCount),0)
    FROM #tblData
    WHERE CostCenter = @costCenter
    AND ServiceCode
    IN(SELECT
    DISTINCT [ServiceCode]
    FROM [DsPcDb].[dbo].[Service_T]
    WHERE [Name]
    NOT
    LIKE
    '%color%'
    AND [Name]
    NOT
    LIKE
    '%scan%'
    AND [Name]
    NOT
    LIKE
    '%fax%'
    AND [ServiceCode] <=
    196623)
    END
    ...and here is some text from the "02" output .txt file, with the leading zero stripped out of the third column:
    11/21/2014,00000-24057,2,1125
    11/21/2014,00001-MKTG12,2,150
    11/21/2014,40059-00395,2,62
    11/21/2014,40059-00409,2,32
    11/21/2014,40059-00428,2,12
    11/21/2014,40059-00432,2,2
    11/21/2014,40059-00434,2,218
    This won't let the receiving database import the data. ("02" is a specific code.) Three other txt files from this
    procedure are imported properly.
    Please help! Thanks!

    You need to cast the servicecode field to varchar to make sure it retains leading zero.
    So in your case make variable type varchar and also places where you select from field cast it to varchar.
    Please Mark This As Answer if it solved your issue
    Please Mark This As Helpful if it helps to solve your issue
    Visakh
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Leading zeros in CSV file.

    Hi Team,
    I need to retain leading zeros in CSV file.
    I could eliminate this problem in XLS file by using this tag in the RTF Template:
    <fo:bidi-override direction="ltr" unicode-bidi="bidi-override"><?XML_ELEMENT?></fo:bidi-override>.
    So, when i do an Export from Publisher for excel document its gives me correct values. i.e zeros are retained.
    But when i select "CSV" and then hit Export , it gets saved in txt file and the txt file has the zeros.
    but when i rename it to ".csv" and open it does not retain zeros.
    Can you please let us know how can we achieve this.
    Thanks for help!
    Bhupendra Gupta

    Hi Bhupendra,
    If its a number the leading zeros will be eliminated in CS in the default CSV .can't do much on this.
    But if use the delimiter e-text and get the output file, you can get the leading zeros as needed..
    Follow this
    http://winrichman.blogspot.com/2009/09/delimiter-based-e-text.html
    http://winrichman.blogspot.com/search/label/BIP%20E-text

  • Need formula to take text from one cell, add that to a serial number with leading zeros

    I'm trying to create a spreasdheet cell that simplifies creating videotape Numbers from a job name in cell and appends a serial number with leading zeros, and that would survive an export to EXCEL.
    The result would look like
     A Column
    Job Name
    B ColumnTape #
    Formula needed for B
    ClientName-TapeType-
    ClientName-TapeType-001
    =
    ClientName-TapeType-
    ClientName-TapeType-002
    =
    I've tried using a custom cell format that had the text in front of the (Integer) drag and drop, with three integers and leading zeros.
    That worked, but requires recreating the custom cell format for each client and tape type.
    So, I've used the formula =A2& in order to play around with different things, but haven't hit on something that adjusts for increased numbers and retains the leading zeros.
    I don't mind doing a starter for the first row and then adding +1 in the formulas for the rows below.
    I've done that using the custom cell formats for the first B cell and then using =Bx+1 in the following cells.  It works, but I'm hoping to find something simpler or that can be copied and pasted in multiple rows on one paste.
    Thanks in advance.
    Suggestions much appreciated!
    Ted

    Ted,
    This expression in B will give you the pattern I believe you are looking for:
    =A&RIGHT("00"&ROW()-1, 3)
    Here's a screen shot...
    Jerry

  • Excel - CSV leading zeros

    Hi
    I get sent an Excel workbook from a client that I need to save as a CSV file so that I can then use the CSV file with another piece of software. When I save the workbook as a CSV file, then when I open it again, the cells in column A don't retain the
    leading zero. In the workbook, the data in column A is entered as '012345.
    Any ideas?
    Viv
    Viv Haig

    Hi,
    Any update?
    Regards,
    Melon Chen
    Forum Support
    Come back and mark the replies as answers if they help and unmark them if they provide no help.
    If you have any feedback on our support, please click
    here

  • Leading Zeros in Zip Code

    I frequently export address information from a database to a tab-delimited text file and then import it into Numbers. However, some zip codes have leading zeros (i.e., "00644"). When I import this file into Numbers the zip codes with leading zeros lose their zeros (i.e., the field looks like ... "644").
    If I format the field after the import as "Text," it doesn't resolve the problem.
    How do I retain these zeros?

    briegull wrote:
    Yvan only discusses Apple products but I look for the best, cheapest solution I can find. In this case it's the free NeoOffice (I would guess Open Office would be the same).
    I do what we are supposed to do on this forum.
    excerprt from Terms of Use:
    +*What is Apple Discussions and how can it help me?*+
    +Apple Discussions is a user-to-user support forum where experts and other Apple product users get together to discuss Apple products.+
    Why being able to format zip codes (when probably a quarter of the US population has a zip code that starts with a leading zero)
    As 0 is one digit among ten, my guess is that the real percentage is about 10%
    is considered beyond the "eighty percent" rule that Yvan cites often, I don't understand, but the solutions he proposes aren't very realistic for spreadsheets created frequently.
    The given soluce may be "not realistic" but it is used since 1990 by AppleWorks's users.
    But a Numbers's user may refuse to apply the given workarounds and wait for enhancements.
    For some of them he will have to wait until iWork'09, for others for iWork'10 …
    I think that helpers are here to give workarounds for today, not to give false hopes.
    Here is an excerpt of Apple Human Interface Guidelines
    +Apply the 80 Percent Solution+
    +During the design process, if you discover problems with your product design, you might consider applying the 80 percent solution‚ that is, designing your software to meet the needs of at least 80 percent of your users. This type of design typically favors simpler, more elegant approaches to problems.+
    +If you try to design for the 20 percent of your target audience who are power users, your design may not be usable by the other 80 percent of users. Even though that smaller group of power users is likely to have good ideas for features, the majority of your user base may not think in the same way. Involving a broad range of users in your design process can help you find the 80 percent solution.+
    Yvan KOENIG (from FRANCE mardi 19 février 2008 14:54:36)

  • Leading zeros in XLS sheet

    Hello Experts,
    I have one report in ALV format. It is displayed perfect.
    When we download it into XLS format it appends leading zeros in 'NETWORK no' Field.
    Can you all please help me how to remove it?
    Remember, ALV is showing perfect o/p. So
    CONVERSION_EXIT_ALFA_OUTPUT  or any other FM in that category is of no use.
    Also there is no code to download in XLS. User selects Standord procedure to download from ALV.
    But he is getting Leading zeros.
    I would be thankful for the help.
    Best Regards,
    Harish

    HI Joshia,
    Lets consider you are downloading MATNR which comes with leading Zero.
    We solve this by below case .
    you can download the value in character format with preceding single quote .
    if you are downloading 000010 means, assign that value as '000010.
    So that, excel can treat it as character & the zeros will be retained.
    While uploading the data to internal table it_material
    CONCATENATE '"' it_material-matnr into it_material-matnr.
    append it_material.

  • How to maintian leading zeros in BI ?

    Hi All,
    We have a requirement for one InfoObject called "0RPA_MEAN" EAN Assignment to Article for this info object i need to maintain a leading zeros as its coming from R/3 end?
    Ex: In R/3 side EAN 123 is different than EAN 0123,EAN 00123.
    But while extracting in BW end the the leading zeros is getting skipped off?How to retain the leading zeros?
    In rsa3 its coming with the same leading zeros but in psa its not showing it?
    This is very serious issue going on, need your valuable inputs on this?
    Many thanks in advance.
    *Points Assured*

    Hi Rakesh,
                       When you extract data to BI there won't be any leading zeroes. So in PSA there won't be any leading zeroes.
    To bring leading zeroes from PSA itself.
    Double click on your datasource in rsa1. Click on the 'Fields' tab. Type 'ALPHA' for the source system field under the column 'Conv. Routines'. I think that will solve the problem.
    To bring leading zeroes after PSA (ie. from transformation onwards)
    But when load data from PSA to further data targets using transformation we can add leading zeroes.
    So in transformation click on rule details for that info object. In the rule details you have to use a function module called 'CONVERSION_EXIT_ALPHA_INPUT'.  when you use this function module the leading zeroes will be added automatically.
    Thanking you,
    Jerry
    Edited by: jerryabap on Oct 14, 2010 5:52 AM

  • Leading zeros problem with custom popup

    I've implemented a custom popup page following the How-To docs on the topic. The value I'm return to the calling page in the passback function most often will have leading zeros. So from the custom popup I do a call like this: javascript:passback(00363644). When my value arrives back on the calling page it's converted to 124836 (haven't yet figured out what kind of conversion is happening there).
    I realize this is not a javascript forum (and I've Googled for leading zeros in javascript to no avail - yet) but the HTML DB field type Popup LOV seems to accomplish this just fine so I was wondering how Oracle might be doing it. Anyone have any ideas?
    Earl

    Vikas,
    See
    http://tinypic.com/ibbfoy.jpg
    So, just use
    javascript:passback("00363644")and it should do what you want.You would think. But I've tried:
    wrapping it in single quotes:
    opener.document.getElementById('P6_CONTACT_ID').value = "'" + myVal + "'";
    wrapping it in single quotes:
    opener.document.getElementById('P6_CONTACT_ID').value = """ + myVal + """;
    and the other 'trick' that I've seen mentioned several places, concatenating an empty string to the value:
    opener.document.getElementById('P6_CONTACT_ID').value = "" + myVal;
    All to no avail! This is really frustrating. Supposedly, any string concatenation action will 'force' the value to retain it's original 'string-ness'.
    Working off this assumption and thinking that the conversion had already taken place by the time I assigned the value I backed up a step and assigned the value to a variable before trying to set the value, ala:
    var myVal = p_Value.toString();
    opener.document.getElementById('P6_CONTACT_ID').value = myVal;
    and still no joy.
    Following this logic one step further, do I need to get the value to a string in the original call. This will be a challenge because the link in the popup report is a is set to a URL with javascript call, like this: javascript:passback(#CONTACT_ID#);
    Further, when I float over the links with the mouse I can see the URL in the status bar of the browser as javascript:passback(00363644); So, how do I go about wrapping this in quotes in the link?
    Any help???
    Earl

  • Leading zero problem!

    Hi !
    i have a numeric type variable i.e. 'w_xyz type n length 7'
    now i want to delete the leading zero's for this variable simultaneously want to retain the length of the field unaltered i.e.
    if  w_xyz = '0000987'  then i want
    w_xyz = '    987'.
    any help pls,
    Thanks in advance.
    Regards,
    Parwez.

    Hi,
    There is a simple way to achieve that : just use shift statement.
    SHIFT w_xyz LEFT DELETING LEADING '0'.
    Regards,
    Nicolas.

Maybe you are looking for

  • How do I stop contacts duplicating

    how do I stop my contact from duplicating every time I sync Iphone

  • Where can i get a replacement screen for my iphone 5

    I dropped my phone and the lcd now has lines running down the whole of the screen and was wondering where I can get a genuine replacement screen?

  • How to handle dynamically created checkboxes in JSP???

    Hello everybody, In a JSP page I would like to create checkbox dynamically on every result line (detail line), then check in some of them and finally pass the checked lines to a JSP bean which will handle them on a submit button press. The problem ar

  • IPhone to Aperture

    I am sitting here with my iPhone 4s attached to my MacBook Pro, trying to import 8 selected pics from a recent trip into a selected project in Aperture 3.5.1. When I attached the phone it automatically uploaded 49 pics. But I cannot find the in any A

  • Replace Attributes Content ?

    Is there a FCPX equivelant to Replace Attributes > Content? I have several plaeholder clips with all atributes set on my timeline. Now I need to replace them with different media, but want to retain cropping, timing, in and outs, etc. I know I can co