CoolInterview.com - World's Largest Collection of Interview Questions
Start Your Own website Now
Sponsored Links

Interview Questions
Our Services

Get 9,000 Interview Questions & Answers in an eBook.


  • 9500+ Pages
  • 9000 Question & Answers
  • All Tech. Categories
  • 14 MB Content

    Get it now !!



    Send your Resume to 6000 Companies


  • INTERVIEW QUESTIONS DATABASE SYBASE DETAILS
    Question :
    How to pad with leading zeros an int or smallint in Sybase?
    Category Sybase Interview Questions
    Rating (0.2) By 132 users
    Added on 7/1/2011
    Views 355
    Rate it!
    Answers:

    By example:
    declare @Integer int
    /* Good for positive numbers only. */
    select @Integer = 1000

    select "Positives Only" =
    right( replicate("0", 12) + convert(varchar, @Integer), 12)

    /* Good for positive and negative numbers. */
    select @Integer = -1000

    select "Both Signs" =
    substring( "- +", (sign(@Integer) + 2), 1) +
    right( replicate("0", 12) + convert(varchar, abs(@Integer)), 12)

    select @Integer = 1000

    select "Both Signs" =
    substring( "- +", (sign(@Integer) + 2), 1) +
    right( replicate("0", 12) + convert(varchar, abs(@Integer)), 12)

    go

    Produces the following results:

    Positives Only
    --------------
    000000001000

    Both Signs
    -------------
    -000000001000

    Both Signs
    -------------
    +000000001000



    If you have the better answer, then send it to us. We will display your answer after the approval.
    Rules to Post Answers in CoolInterview.com:-

  • There should not be any Spelling Mistakes.
  • There should not be any Gramatical Errors.
  • Answers must not contain any bad words.
  • Answers should not be the repeat of same answer, already approved.
  • Answer should be complete in itself.
  • Name :*
    Email Id :*
    Answer :*
    Verification Code Code Image - Please contact webmaster if you have problems seeing this image code Not readable? Load New Code
    Process Verification  Enter the above shown code:*
    Inform me about updated answers to this question

       
    Related Questions
    View Answer
    Divide by zero and nulls in Sybase?
    View Answer
    How do I bcp null dates in Sybase?
    View Answer
    How do I pipe the output of isql to a file in Sybase?
    View Answer
    How do I make isql secure in Sybase?
    View Answer
    Are there any alternatives to isql in Sybase?
    View Answer
    How do I pipe the output of one isql to another?
    View Answer
    How to remove row affected and dashes?
    View Answer
    Can I use a named pipe to bcp/dump data out or in in Sybase?
    View Answer
    How do I exclude a column in Sybase?
    View Answer
    Would RPC or CT-Lib be better/faster?
    View Answer
    Alternative to row at a time processing in Sybase?
    View Answer
    When should I execute an sp_recompile in Sybase?
    View Answer
    When are stored procedures compiled in Sybase?
    View Answer
    What causes re-resolution of a stored procedure in Sybase?
    View Answer
    What will cause the size of a stored procedure to grow in Sybase?
    View Answer
    What are the different types of (All Page) locks in Sybase?
    View Answer
    How do I find the oldest open transaction in Sybase?
    View Answer
    How do I check if log truncation is blocked in Sybase?
    View Answer
    The timestamp datatype in Sybase?
    View Answer
    How do I remove duplicate rows from a table in Sybase?
    View Answer


    Please Note: We keep on updating better answers to this site. In case you are looking for Jobs, Pls Click Here Vyoms.com - Best Freshers & Experienced Jobs Website.

    View ALL Sybase Interview Questions

    User Options
    Sponsored Links


    Copyright ©2003-2014 CoolInterview.com, All Rights Reserved.
    Privacy Policy | Terms and Conditions

    Download Yahoo Messenger | Placement Papers| FREE SMS | ASP .Net Tutorial | Web Hosting | Dedicated Servers | C Interview Questions & Answers

    Testing Articles | Testing Books | Testing Certifications | Testing FAQs | Testing Downloads | Testing Interview Questions | Testing Jobs | Testing Training Institutes


    Cache = 0.015625 Seconds