How to convert string to 16 characters.

My external unique id is too long, more then 30 characters.
How to convert it to 30 characters using sql?

You should find another extranal system id in order to mantain uniqueness, but you could also use the name field (that supports 50 characters), but it deppends of which entity you are using.
Which is the entity? and...if the only way to insert data is by web services the you could use more than one field to verify uniqueness since you can query more than one field at the time.
Hope it helps
Kim.

Similar Messages

  • How to convert string to an integer in SQL Server 2008

    Hi All,
    How to convert string to an integer in sql server,
    Input : string str="1,2,3,5"
    Output would be : 1,2,3,5
    Thanks in advance.
    Regards,
    Sunil

    No, you cannot convert to INT and get 1,2,3 BUT you can get
    1
    2
    3
    Is it ok?
    CREATE FUNCTION [dbo].[SplitString]
             @str VARCHAR(MAX)
        RETURNS @ret TABLE (token VARCHAR(MAX))
         AS
         BEGIN
        DECLARE @x XML 
        SET @x = '<t>' + REPLACE(@str, ',', '</t><t>') + '</t>'
        INSERT INTO @ret
            SELECT x.i.value('.', 'VARCHAR(MAX)') AS token
            FROM @x.nodes('//t') x(i)
        RETURN
       END
    ----Usage
    SELECT * FROM SplitString ('1,2,3')
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • Essbase 9.3 Calc scripts. Pb with dates. How to convert (string = number) ?

    Hello,
    I've a problem with Essbase(Planning?) Scripts on version 9.3. It looks simple but I do not find any (clean) solution :
    On my Essbase database, I have a member called "Reference_Date" on my axis Indicators. It is a date data type, that is to say, it displays a number corresponding to a YYYYMMDD format. For example : 20091029 for October 29th 2009.
    In calc scripts I often need to compare the month included in that "Reference_Date" with the current Member of my Time Axis (I have 12 Months members based on the format M02 for February for example). The final aim is to calculate a number of complete years since that "Reference_Date".
    But theses two elements are not of the same "type" (one is a number value and the other is a "member" in Time Axis). So I'm forced to convert one of this two elements in order to compare it.
    For example I can extract the month value of the "Reference_Date"' and put an "M" before it to have a Time member equivalent or I can convert the member Name M10 to a number (10))
    in both cases I have the same type problem : I don't know how to convert a string into a number nor how to convert a number into a string.
    (For example @CONCATENATE doesn't work with numbers). and that my only remaining problem.
    I didn't find any Essbase Function which do this (conversion number <=>string).
    Is anyone have an Idea ?
    Thanks for your help
    Best regards

    I don't know any way for you to compare your data against your metadata. Not directly. To me it makes little enough sense to try that I'm not surprised the developers didn't provide for it.
    I've converted member names to strings, manipulated the strings (calc script functions are not good at this), and turned them back into member names, but that's really the only use I've had for string manipulation. I don't think an equivalency operator even exists for string data. And I see no way to begin thinking of a member name, once converted to a string, as a number.
    It makes even less sense to me to try thinking of a data value as a string. Even text values in Sys 11 are stored as numbers. Not encoded characters, but just a number to look up somewhere.
    I think you can do what you want though, with something like this...
    IF (@ISMBR("FY08"))
    vYr = 2008;
    ELSEIF (@ISMBR("FY09"))
    vYr = 2009;
    ENDIF;
    IF (@ISMBR("M01"))
    vMth = 1;
    ELSEIF (@ISMBR("M02"))
    vMth = = 2;
    ENDIF;
    "Years_Since_Reference" = ((vYr * 100) + Mth) - ("Reference_Date" / 12);
    Obviously, the math will need some work, coz that doesn't actually work, but the logic above essentially turns your metadata into numbers, which is what you are after.
    Good luck,
    -- Joe

  • How to convert String (dd-MMM-yyyy) to oracle.jbo.domain.Date

    Hi
    Could you please tell how do I convert String of date in format dd-MM-yyyy to ADF date? Please show me some sample.
    Thanks

    http://javaalmanac.com/egs/java.text/FormatDateDef.html
    Once you have a java.util.Date you can convert it to oracle.jbo.domain.Date. (see http://www.fifkredit.com/bc4jdoc/rt/oracle/jbo/domain/Date.html)

  • How to converts string into numbers

    As a beginer now i am asking the above question?
    now i am working with XCode 4.3

    I responded to you here > How to convert pages document into...: Apple Support Communities
    Please do not start duplicate topics 

  • How to convert string yyyy-mm-dd to date dd/mm/yyyy

    Hi Experts,
    I am getting date in the form of string 2007-06-30 from R/3. How I can convert this string into a date in the form 30/06/2007. I have to use java.sql.Date.
    Following code is not working. As for executing the following code, I have to use java.util.date. I can not use java.util.date as the Web Dynpro program uses java.sql.Date.
         SimpleDateFormat sdf1 = new SimpleDateFormat("dd/mm/yyyy");
         Date d = null;
         d = sdf1.parse(wdContext.currentContextElement().getDateClicked());
    Regards,
    Gary

    Hi,
    If I understood you right you need this date typed as a java.sql.Date?
    String ds=wdContext.currentContextElement().getDateClicked();
    SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");     
    java.sql.Date sd = new java.sql.Date(sdf.parse(ds).getTime());
    Four remarks:
    We "transport" the Date from java.util.Date to java.sql.Date as milliseconds since January 1, 1970, 00:00:00 GMT. See contract of java.sql.Date.
    You used dd/mm/yyyy instead of dd/MM/yyyy, but mm are the minutes and not the months, see the contract of [SimpleDateFormat|http://java.sun.com/j2se/1.4.2/docs/api/java/text/SimpleDateFormat.html] (JSE 1.4) .
    You do not set the time zone for DateFormat, so you use TimeZone.getDefault(). This is your JVM's default time zone and depends (if you did not change it) on your systems time zone. F.e. I live in Germany, the time zone of my system is currently MEZ (which is UTC+1) since we left the daylight saving time zone last sunday. Since you only parse the date and not the time zone f.e., you expect the date (the string) to be in your default time zone. If this is not the case, you have to set the time zone to the time zone you expect the date to be in (f.e. sdf1.setTimeZone(TimeZone.getTimeZone("UTC"));) before parsing the date. This might seem marginal in your case, but may produce unexpected results with date comparisons and date parsings around the day change.
    SimpleDateFormat is not thread-safe, so please do not cache it! This is not mentioned in the Javadoc of JSE 1.4, but can be looked up at [Sun's bug database|http://bugs.sun.com/bugdatabase/view_bug.do;jsessionid=96669461418011fffffffffb70dd6b6e88eb5?bug_id=4264153]. If you are not satisfied with the standard Date & Time handling (f.e. performance reasons) you might want to consider an alternative like [Joda Time|http://joda-time.sourceforge.net/index.html] which is published under [ASF 2.0 license|http://joda-time.sourceforge.net/license.html]
    Best regards,
    Fabian

  • How to convert String to date ? - MS access

    I want to convert a string "10-10-08" [ MM-dd-yy ] into date type in same format to use that in query statement [MS Access].
    In table , I am using field called "date" with "MM-dd-yy" format.
    Example:
    <%@ page import= "java.sql.*"%>
    <%@ page import="java.text.SimpleDateFormat"%>
    <%@ page import="java.util.Date"%>
    <%
    String d="10-9-08";
         SimpleDateFormat dateFormat = new SimpleDateFormat("MM-dd-yy");
              Date date = dateFormat.parse(d);
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
         Connection con = DriverManager.getConnection("jdbc:odbc:bspipdb");
         Statement st = con.createStatement();
    ResultSet rs=st.executeQuery("Select * from datacollectdb where date='"+date+"'");
    %>
    I am getting "java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.
    " error.
    How to use the string "10-10-08" in where statement?

    sangee wrote:
    I want to convert a string "10-10-08" [ MM-dd-yy ] into date type in same format to use that in query statement [MS Access].
    In table , I am using field called "date" with "MM-dd-yy" format.I think a column named "date" is a very bad idea. Not just because "date" is a keyword. It's not very self-describing. How about "birth_date" or "hire_date" or "went_on_my_first_date"?
    Example:Scriptlets? There's your second mistake.
    <%@ page import= "java.sql.*"%>
    <%@ page import="java.text.SimpleDateFormat"%>
    <%@ page import="java.util.Date"%>
    <%
    String d="10-9-08";The way you're doing things, "2-40-99" is a valid date. Is that what you want?
         SimpleDateFormat dateFormat = new SimpleDateFormat("MM-dd-yy");
              Date date = dateFormat.parse(d);
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
         Connection con = DriverManager.getConnection("jdbc:odbc:bspipdb");Wrong again. Better to use a PreparedStatement and bind that Date.
         Statement st = con.createStatement();
    ResultSet rs=st.executeQuery("Select * from datacollectdb where date='"+date+"'");
    %>
    I am getting "java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.
    " error.
    How to use the string "10-10-08" in where statement?Use PreparedStatement and bind.
    Your JSP should not be getting a database connection. Pool it.
    Your code is wrong on every level. You don't close resources, you don't separate you app into layers, your database code is not in a POJO. I'd recommend that you throw this away and start again.
    %

  • How to convert string to date based on regional settings

    How can I convert a simple string ("01/04/2003" or "01-04-2003" or "01 April 2003") to a date formatted according to the regional settings?
    For example, if my regional settings is set to "dd mm yyyy", the result will be 01 as dd, 04 as mm and 2003 as yyyy.
    If the regional settings is set to "mm dd yyyy", the result will be 01 as mm, 04 as dd and 2003 as yyyy
    Hope someone can help.
    Thanks in advance.

    I think you have the wrong idea about how Oracle stores dates. Any date in Oracle is stored in a seven byte representation
    SQL> SELECT DUMP(last_hire_dt) FROM emp_t WHERE rownum = 1;
    DUMP(LAST_HIRE_DT)
    Typ=12 Len=7: 119,191,5,6,1,1,1This storage is independent of the NLS date settings. The TO_CHAR(dt,format) and TO_DATE(str,format) functions serve to translate this internal representation into the external presentation supplied by the format. So, if you need to translate a date that is contained in a string into an Oracle date datatype, you need to tell Oracle how to parse the string.
    If the string format matches your NLS_DATE_FORMAT parameter, Oracle will do this implicitly. Otherwise, you need to tell Oracle explicitly which piece is which. For example, is the string (ignoring the problem of two digit years :-) ):
    '02/01/03'
    Feb. 1, 2003, Jan. 2, 2003, or Mar. 1, 2002? If your date format is dd-MON-yyyy as mine is, then:
    SQL> SELECT TO_DATE('02/01/03') FROM dual;
    SELECT TO_DATE('02/01/03') FROM dual
    ERROR at line 1:
    ORA-01843: not a valid month
    SQL> SELECT TO_DATE('30-Jan-2003') FROM dual;
    TO_DATE('30
    30-JAN-2003HTH
    John

  • How to convert string date to long (or Unix date)?

    I'm having difficulty in converting a user supplied date in the format mm/dd/yyyy to a long format such as 1035462807000. Since it's being entered by the user I can't just use the current system date. Any suggestions? Thanks!
    Dave

    Hi man, tsith Gave a good beggining, why dont you try the next code
    import java.text.DateFormat;
    import java.text.SimpleDateFormat;
    import java.text.ParseException;
    import java.util.Date;
    public class DateToUnix{
        public static void main(String args[]){
            getDateAsLong();
        public static void getDateAsLong(){
            String sStartDate = "12/01/2002";
            Date theDate;
            DateFormat sdf= new SimpleDateFormat("MM/DD/yyyy" );
            try {
                theDate = sdf.parse( sStartDate );
            }catch(ParseException e ){
                theDate = new Date();
            System.out.println( "Converted Start Date:" + theDate.getTime());
    }No mather how you get a Date object, the value you are looking for is a long, and you can get it from such object with the getTime() method.
    Take a look at the Java API @ [http://java.sun.com/j2se/1.4.1/docs/api/java/util/Date.html#getTime()]

  • How to convert string to decimal in data association function?

    In a BPM Script component, how in the Data Association can I use an expression to convert an argument from String to Decimal?  I have a Process argument named percentage which is a string.  I need to set the value of a data object called signed to either "Y" or "N" based on the percentage being greater than 0.4.  Something like this:
    (percentage > 0.4) ? "Y" : "N"
    The problem here is that percentage is a string, so must be converted to a decimal value before the compare will work.  I cannot find a function that allows that.  I need something like parseDecimal(percentage), but the Expression Builder does not offer that for a string using a Simple Expression.
    If it cannot be converted, is there another way to do this?

    Guessing you figured this out on your own, but if you wanted to use a Script activity one way to do what you want is when you're creating your data associations drag the "Expression" icon in the middle and double click the icon in the middle you just added:
    Get out of the Simple expression mode and into the XPath expression mode by clicking the dropdown in the upper left corner -> click "XPath Exp".
    In the Functions dropdown on the right, click "Conversion Functions" -> click "number" and then insert it into the expression.
    In the Variables list, select your string variable and insert it into the number function so that it looks something like this:  number(bpmn:getDataObject('myStringVariable'))
    Click OK
    Click your expression icon in the middle and drag it over your decimal variable.
    To have it evaluate and return a Boolean expression in your Script activity, add a Boolean process variable and add an XPath expression as described above except have the logic be this:  number(bpmn:getDataObject('myStringVariable')) > .4  (the "greater than" shown above is added to the expression by clicking "Logical Functions" from the functions dropdown).  Click OK and drag your expression icon over your Boolean variable.
    Dan

  • How to convert String to int in JSP?

    Hi,
    I set a session attribute in Servlet and want use it in JSP, How can I convert it to int or Integer?
    the line in my code doesn't work:
    int quantity=(int)session.getAttribute("vehiclequantity") ;
    Thanks in advance.
    Wolf
    +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    <HTML>
    <HEAD>
    <TITLE>Using the for Statement</TITLE>
    </HEAD>
    <BODY>
    <H1>Using the for Statement</H1>
    <%=session.getAttribute("vehiclequantity") %>;
    <%
    int loopIndex;
    int quantity=(int)session.getAttribute("vehiclequantity") ;
    out.println(quantity);
    for (loopIndex = 1; loopIndex <=2; loopIndex++) {
    out.println("This is iteration number "
    + loopIndex + "<BR>");
    %>
    </BODY>
    </HTML>

    Learning how to read errors and understand them will help you solve your problems quicker by yourself... So lets take a look at the error and classes involved...
    The error says:
    "Cannor Resolve Symbol: method valueOf(java.lang.Object) in the class java.lang.Integer" and gives you line line where the error occurs: Integer quantity = Integer.valueOf(session.getAttribute("vehiclequantity"));
    Now, if we look at the API for the Integer we notice that are are only two valueOf methods: valueOf(java.lang.String s) and valueOf(java.lang.String s, int radix). Not valueOf(java.lang.Object) method.
    Now we look at the getAttribute(java.lang.String name) method of HttpSession we see that the method returns a java.lang.Object. Now, you know you put a java.lang.String into that attribute, but the get method returns an Object. This is because you could have put any object in there, an Integer, a String, or some other class instance. But you know it is a String, so you can cast the returned value to a String, so that you will be calling the valueOf(java.lang.String s) method of Integer with the Object returned from the HtttpSession's getAttribute(java.lang.String name) method:
    Integer quantity = Integer.valueOf((String)session.getAttribute("vehiclequantity"));

  • How to convert String array into int.

    void getSoldSms(Vector vecSoldSms)
         String str[]=new String[vecSoldSms.size()];
         String words[]=new String[str.length]; // String array
              for(int i=0;i< vecSoldSms.size();i++)
                   str=(String)vecSoldSms.get(i);
              }               //End for
              for(int i=0;i<str.length;i++)
              words = str[i].split("\\|\\|");
              System.out.println();
              for(int j=0;j<1;j++)     
              int count[str.length]=Integer.parseInt(words[i]);
              System.out.print(count[j]*advance_count);
              } // end inner for loop
              }          //End for
         }          //End function getSoldSms
    how do i convert words which is a string array into int type. i kno string can be converted into int using interger.parseint. but wat abt string arrays??? plz help me out with the above code.

    i did tht its still giving the same errorFor Heaven's sake, what about taking a second to try to understand the code you're copying first? If you really can't fix the error yourself, you have a more serious problem than just convertingStrings to ints.
    And if you want { "1", "2", "3" } to be 123:
    StringBuffer b = new StringBuffer();
    for (int i = 0; i < array.length; i++) {
      b.append(array);
    int result = Integer.parseIn(b.toString());

  • How to convert lowercase to uppercase characters?

    Hi!
    I am a newbie to LiveCycle; I have created a form but I want all characters in the field to automatically be converted to uppercase, regardless of the input.
    Thanks
    Jofar1

    Thanks Paul.
    How do I get the "exit event" option?

  • How to convert string YYYY.MM.DD HH:MM:SS to DD/MM/YYYY HH:MM:SS

    Hi, i need a help
    I have a string for examples 2005.06.22 09:15:15 so i need to get in in other format. It must be 22/06/2005 09:15:15 how to do that?
    Thanks a lot

    I am asking only if i cant find in google or it is
    not clear for me in documentationYou could in that case have said that you had checked the documentation but that you didn't understand instead of posting.
    Need a example, thanksSo, what is it that you don't understand in the documentation? I have already told you to use the parse and format methods of SimpleDateFormat. It's essential for a developer to learn how to read documentation, and I'm willing to explain the parts that you don't understand, if you post what you have tried with an explanation of why it didn't work.
    /Kaj

  • How to convert string to date

    HI Everyone,
    i am trying to convert a date which is in string format to a date format...but i am having this error
    javax.servlet.ServletException: Unparseable date: "2004-05-03"
    Can anyone help?
    Here is a piece of code :-
    SimpleDateFormat formatter= new SimpleDateFormat ("yyyy-mm-dd");
    Date today = formatter.parse(fulldate);

    You need to change your formatting string to: "yyyy-MM-dd" Lower case 'm' is for minutes...

Maybe you are looking for