Convert smalldatetime type SQL format to Date in OBIEE

I have a SQL database which holds date in the smalldatetime type SQL format. I want to read this date in the OBIEE. How I can achieve this. I didn't find any direct CAST for this OBIEE Answers.
thanks,
Naresh

sorry to confuse here. I would reframe my question as following
Hi,
I have a data in SQL Database which is in ‘float’ format. The data is being stored for TimeStamp such that casting it for ‘smalldatetime’ gives the exact timestamp in SQL Server.
For example I have dates (dTime) column and the converted columns when did casting for smalldatetime gives following result (in SQL Server)
dTime (Float) ########################## small_date_time (CAST dTime AS smalldatetime)
40322.271099537 ########################## May 26 2010 6:30AM
40322.275706018503 ########################## May 26 2010 6:37AM
40415.121770833299 ########################## Aug 27 2010 2:55AM
Now problem is I have this (dTime) column coming as Double in OBIEE and when I’m trying to convert this to TIMESTAMP/DATE it gives error.
To Simplify I tried following query in Answers directly.
CAST(CAST('40322.271099537' AS CHAR) AS TIMESTAMP)
and the error shown is below
State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 43113] Message returned from OBIS. [nQSError: 43119] Query Failed: [nQSError: 46046] Datetime value 40322.271099537 does not match the specified format. (HY000)
Do we have a way to get the format right by using cast or any other function.
Edited by: naresh kumar on Oct 20, 2010 2:25 AM
Edited by: naresh kumar on Oct 20, 2010 2:26 AM

Similar Messages

  • CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT =SHOW DATE

    Hello everyone.
    The version I am using oracle 11g
    2 questions:
    1 .- CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/ ora_backup / backupset /% F'; I get error
    I want the backup to show the date format, as it can get.
    2 .- CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/ ora_backup / backupset /% F_.bak';
    rename the extension back to. Bak, one can view the SQL SERVER.
    Thanks,Bye.

    %F is only vaild for controlfile autobackups, there are other elements to store the date:
    http://download.oracle.com/docs/cd/B28359_01/backup.111/b28273/rcmsubcl010.htm#i82206
    Werner

  • Converting UCS-2 (sql 7.0) data to utf8 (oracle8i)

    Hi all...
    We have a database in sql-server 7.0 supporting unicode data using the ucs-2 encoding. When i use oracle migration tool to migrate this data to the oracle8i database on solaris i get ora-12704 error , character set mismatch. I undestand that oracle supports unicode with utf8 encoding. What are the settings that i need to change for the oracle database to support ucs2 encoding.
    Does migration work bench not do the conversion automaticlly??
    any help on this will be appreciated
    thanks in advance
    sasidhar([email protected])
    null

    I am in the process of writing up a breakdown of the different implementation of unicode between Oracle and Microsoft and will post it to OTN as soon as it is ready (hopefully within the next couple of weeks). If you would like to see it sooner drop an email to [email protected]
    I would suspect that you are getting the character set mismatch because you are trying to insert data into datatype char using the N'abc' literal (or perhaps vice versa, not using N'abc' when inserting into nchar).
    If you could drop an email to [email protected] with details of the exact mapping you used and what you are trying to do then we will help clarify it.
    Regards,
    Marie

  • Convert String to sql date

    hi all,
    i have a date in string format Tue, 06 Feb 2007 12:38:17 GMT
    How do i convert it to sql datetime.
    Date date = new Date("Tue, 06 Feb 2007 12:38:17 GMT");// creating date
              java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(
                        "yyyy-MM-dd HH:mm:ss");// format definition
              java.sql.Time pubDate = java.sql.Time.valueOf(sdf.format(date));
              System.out.println(pubDate);This code gives me java.lang.NumberFormatException.
    Thanks in advance.......
    VikraM

    is "EEE d MMM yyyy HH:mm:ss Z" your default data format
    if not your first constructor will not parse date properly so your date object contains invalid date, when you try to format it it throws exception.
    check it
    sudhir nimavat

  • Conversion failed when converting the varchar value 'undefined' to data typ

    Conversion failed when converting the varchar value 'undefined' to data type int.
    hi, i installed oracle insbridge following the instruction in the manual. in rate manager, when i tried to create a new "Normal rating" or "Underwriting", im getting the following exception
    Server Error in '/RM' Application.
    Conversion failed when converting the varchar value 'undefined' to data type int.
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
    Exception Details: System.Data.SqlClient.SqlException: Conversion failed when converting the varchar value 'undefined' to data type int.
    Source Error:
    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
    Stack Trace:
    [SqlException (0x80131904): Conversion failed when converting the varchar value 'undefined' to data type int.]
    System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +1948826
    System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +4844747
    System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +194
    System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2392
    System.Data.SqlClient.SqlDataReader.HasMoreRows() +157
    System.Data.SqlClient.SqlDataReader.ReadInternal(Boolean setTimeout) +197
    System.Data.SqlClient.SqlDataReader.Read() +9
    System.Data.SqlClient.SqlCommand.CompleteExecuteScalar(SqlDataReader ds, Boolean returnSqlValue) +50
    System.Data.SqlClient.SqlCommand.ExecuteScalar() +150
    Insbridge.Net.Fwk.DAO.DataAccess.ScalarQuery(String connectionString, String command, Transaction transType, Object[] procParams) +110
    [Exception: Cannot Execute SQL Command: Conversion failed when converting the varchar value 'undefined' to data type int.]
    Insbridge.Net.Fwk.DAO.DataAccess.ScalarQuery(String connectionString, String command, Transaction transType, Object[] procParams) +265
    Insbridge.Net.Fwk.DAO.SqlProcessor.ExecuteScalarQueryProc(String subscriber, String datastore, String identifier, String command, Transaction transType, Object[] procParams) +101
    Insbridge.Net.Fwk.DAO.SqlProcessor.ExecuteScalarQuery(String subscriber, String identifier, String command) +22
    Insbridge.Net.RM.IBRM.ExeScalar(String cmd, Object[] paramsList) +99
    Insbridge.Net.RM.Components.Algorithms.AlgEdit.Page_Load(Object sender, EventArgs e) +663
    System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
    System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
    System.Web.UI.Control.OnLoad(EventArgs e) +99
    System.Web.UI.Control.LoadRecursive() +50
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627
    my insbridge versions are as follows
    IBRU 4.0.0 Copyright ©2010, Oracle. All rights reserved. - Version Listing
    RMBUILD.DLL 4.0.0.0 (x86)
    SRLOAD.DLL 3.13.0 (x86)
    IBRM v04.00.0.17
    IB_CLIENT v04.00.0.00
    RM.DLL 4.00.0 (x86)
    IBFA 3.0.2
    OS: Windows Server 2003
    DB: Sql Server 2008
    Browser: IE8
    how do i solve this, please help

    This is an error due to conversion failed from character string to int datatype. Infact, the table column contains "NO" value which you are trying to convert to Int/SUM which is illegal. Without your code and table structure, its difficult to pinpoint your
    actual issue. But check, all columns for value "NO". 

  • Problems dealing with Boolean data types(SQL).

    Greetings.
    Below is an sql code i am trying to execute.
    select Band, Memb_contact =
    CASE 
    when contact_person >= 0 then 'Yes'
    else 'No' 
    end, Club_Name, Club_contact
    from Members, Club
    where contact_person = 'Yes'
    My column contact_person has a data type of boolean. It stores 1 and -1 only.
    I'm am trying to execute the select statement to return The Band Name and contact number only if the person
    is identified as a contact person in the members table.
    It return the following error:
    Msg 245, Level 16, State 1, Line 1
    Conversion failed when converting the varchar value 'Yes' to data type bit.
    Please help.

    Try the below: You can not have 'Yes' instead use 1.
    select Band, Memb_contact =
    CASE 
    when contact_person >= 0 then 'Yes'
    else 'No' 
    end, Club_Name, Club_contact
    from Members, Club
    where contact_person = 1

  • Please help me in Converting Lilian Format to Date

    Please Convert this "38619" Lilian format date to "DD-MM-YYYY''
    Thanks in Anticipation!!!

    Lilian date is calculated as number of days since 15-10-1582. Julian date is calculated as number of days since January 1, 4713 BC. So there is a fixed offset between those two. Let's calculate it:
    SQL> select to_char(d,'j') -- Julian date
      2    from (select date '1582-10-15' d from dual)
      3  /
    TO_CHAR
    2299161
    1 row selected.This day is Lilian day 1 and Julian day 2299161, so the offset is 2299160.
    SQL> var LILIAN_DATE number
    SQL> exec :LILIAN_DATE := 38619
    PL/SQL procedure successfully completed.
    SQL> select to_date(:LILIAN_DATE + 2299160,'j')
      2    from dual
      3  /
    TO_DATE(:LILIAN_DAT
    08-07-1688 00:00:00
    1 row selected.And if you want it as a formatted string:
    SQL> select to_char(to_date(:LILIAN_DATE + 2299160,'j'),'dd-mm-yyyy')
      2    from dual
      3  /
    TO_CHAR(TO
    08-07-1688
    1 row selected.Regards,
    Rob.

  • Convert DocTime to datetime type and format of HH:MM

    Hi Experts!!
    I am setting up an alert that will run every 5 minutes but would like only those docs created in the last 5 to be selected. In order to accomplish this i would like to use the DATEDIFF funtion. But have a problem in that the DocTime is a smallint (why it's not a datetime is beyond me!) How do I convert it to the proper datetime type and format?
    Thx
    Richard

    Hi Richard,
    check with this just change date smallint to datetime
    select
    (select case when len(oi.doctime)=3 then
    convert (datetime,convert(varchar,( convert(varchar,oi.docdate,103) + ' '+ (left(oi.doctime,1)) + ':'+ (right(oi.doctime,2))) ,114),103) else
    convert (datetime,convert(varchar,( convert(varchar,oi.docdate,103) + ' '+ (left(oi.doctime,2)) + ':'+ (right(oi.doctime,2))) ,114),103) end) as PreparationTime
    from oinv oi

  • PL/SQL Character to date convertion issue

    Dear all,
    I encounter an issue with character to date convertions in PL/SQL.
    The following is a short description:
    I use an Oracle DBMS 8i and the problem is a wrong insertion of a date value to a column table.
    The date value is retrieved from a table and is type of VARCHAR2(240). Then a convertion to the DATE type takes place and this value (date) is inserted to another table column of type DATE.
    For example if the date retrieved as VARCHAR2 is '21/05/2003' the value inserted is '21/5/0003'.
    The convertion is made by the following portion of code:
    dateVariable Date := NULL:
    dateStringVariable is retrieved from the db and is type of VARCHAR2(240)
    DATE_FORMAT is a string retireved from the db with value equals to 'DD/MM/YYYY HH24:MI:SS'
    dateVariable := TO_DATE(dateStringVariable, DATE_FORMAT);
    Then the dateVariable is inserted to a recordSet which in turn is the one inserted to the db.
    My guess is that the problem is during the char to date convertion.
    I wonder if anyone knows what produces this error.
    Any suggestion is welcome.
    With regards

    SQL> desc t
    Name                                      Null?    Type
    DATE#                                              DATE
    SQL> alter session set nls_date_format = 'DD-MON-RR';
    Session altered.
    SQL> select * from t;
    no rows selected
    SQL> insert into t values(to_date('21/05/2003','DD/MM/YYYY'));
    1 row created.Now Oracle keeps correct date - 21th of May 2003.
    How you display it depends on your NLS_DATE_FORMAT settings:
    SQL> select * from t;
    DATE#
    21-MAY-03
    SQL> alter session set nls_date_format = 'MM/DD/YYYY';
    Session altered.
    SQL> select * from t;
    DATE#
    05/21/2003So now try to do
    SELECT to_char(<<your new date column>>,'DD/MM/YYYY') from <<your table>>
    to be sure your date is kept right.
    Rgds.

  • Convert String to Date and Format the Date Expression in SSRS

    Hi,
    I have a parameter used to select a month and year  string that looks like:    jun-2013
    I can convert it to a date, but what I want to do is,  when a user selects a particular month-year  (let's say "jun-2013")
    I  populate one text box with the date the user selected , and (the challenge Im having is)  I want to populate a text box next to the first text box with the month-year  2 months ahead.    So if the user selects 
    jun-2013   textbox A will show  jun-2013 
    and textbox B will show  aug-2013..
    I have tried:
    =Format(Format(CDate(Parameters!month.Value  ),  
    "MM-YYYY"  )+ 2  )   -- But this gives an error
    This returns the month in number format   like "8"    for august...
    =Format(Format(CDate(Parameters!month.Value  ), 
    "MM"  )+ 2  )
    What is the proper syntax to give me the result    in this format =  "aug-2013"  ???
    Thanks in advance.
    MC
    M Collier

    You can convert a string that represents a date to a date object using the util.scand JavaScript method, and then format a date object to a string representation using the util.printd method. For more information, see:
    http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/JS_API_AcroJS.88.1254.html
    http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/JS_API_AcroJS.88.1251.html
    In your case, the code would be something like:
    var sDate = "2013-01-10";
    // Convert string to date
    var oDate = util.scand("yyyy-mm-dd", sDate);
    // Convert date to new string
    var sDate2 = util.printd("mm/dd/yyyy", oDate);
    // Set a field value
    getField("date2").value = sDate2;
    The exact code you'd use depends on where you place the script and where you're getting the original date string, but this should get you started.

  • JTextfield input Date convert to java.sql.Date

    Hi. I have a textfield for users to input date in 'dd/mm/yyyy' format and I would like to format this input into java.sql.Date to be stored into a database. How should I go about doing that ?
    I did the following:
    SimpleDateFormat formatDate = new SimpleDateFormat("dd/mm/yyyy");
    java.util.Date invoiceDate = formatDate.parse(jTextField3.getText());
    java.sql.Date sqlDate = new java.sql.Date(invoiceDate.getTime());and when I input into jTextField3 the value '28/05/2008' , I found in my database '2008-01-28'. January and May is a few months off and is totally not what I wanted.

    Hi you did you code perfect, but you need to change the pattern for formatting the Date
    dd - date
    mm - minute
    yyyy - year
    here you are parsing month as minute, so the output may wrong..!
    If you need to format properly
    please use the below pattern
    {color:#0000ff}SimpleDateFormat formatDate = new SimpleDateFormat("dd/MM/yyyy");{color}

  • Tell me how to format a date retrieved from a MS SQL Server 2000 database?

    Tell me how to format a date retrieved from an MS SQL Server 2000 database for various uses in my JSP page?

    Or if you want to use JSTL instead of a scriptlet see:
    http://forum.java.sun.com/thread.jspa?threadID=676754&tstart=0

  • Converting Oracle query to Sql Server with date manipulation

    The following SSIS statement works great in Oracle, and it parses successfully in the "Sql Task" window. In Oracle it returns
    this result:
    FROM_DT              THRU_DT
    16-Jan-2014      23-Jan-2014
    select
    case
    when to_char(to_date(sysdate,'dd-mon-yyyy'),'dd') <=7 then to_date('24'||to_char(add_months(sysdate,-1),'mmyyyy'),'ddmmyyyy')
    when to_char(to_date(sysdate,'dd-mon-yyyy'),'dd') <=15 then to_date('01'||to_char(sysdate,'mmyyyy'),'ddmmyyyy')
    when to_char(to_date(sysdate,'dd-mon-yyyy'),'dd') <=23 then to_date('08'||to_char(sysdate,'mmyyyy'),'ddmmyyyy')
    else to_date('16'||to_char(sysdate,'mmyyyy'),'ddmmyyyy')
    end as from_dt,
    case
    when to_char(to_date(sysdate,'dd-mon-yyyy'),'dd') <=7 then trunc(last_day(add_months(sysdate,-1)))
    when to_char(to_date(sysdate,'dd-mon-yyyy'),'dd') <=15 then to_date('07'||to_char(sysdate,'mmyyyy'),'ddmmyyyy')
    when to_char(to_date(sysdate,'dd-mon-yyyy'),'dd') <=23 then to_date('15'||to_char(sysdate,'mmyyyy'),'ddmmyyyy')
    else to_date('23'||to_char(sysdate,'mmyyyy'),'ddmmyyyy')
    end as thru_dt
    from sys.dual
    How can I convert this to Sql Server ?

    >>You mean you get the data from Oracle and tries to insert it into SQL Server?
    - no, sorry, I want to convert the syntax to Sql Server
    >>Are
    you running the query in OLEDB provider connected to the Oracle's database?
    - yes, this works fine now (after fixing this redundancy:
    to_char(to_date(sysdate,'dd-mon-yyyy'),'dd')change toto_char(sysdate,'dd')

  • Converting CHAR type to other data types

    Dear SDN users,
    would any of you know how to convert a CHAR data type to other data types for example hexadecimal etc., and convert them back? I suspect there must be some standard FMs available.
    Thankyou for your responses.
    Regards,
    Smitha

    Hello smitha ,
        I suppose you are assigning some  variable of char type to a variable of integer type it will automaticaly (implicitly ) convert the type .
    in some case we need to change the type explicitly like the above mentiioned .
    Thanks and regards ..
      Priyank

  • [Access 2010] Change default formats for data types

    Whenever I import data, the default format for Boolean data types is "-1,0." I know how to subsequently change this format to "Yes/No," but I'd like to change the default
    setting to "Yes/No." Is this possible?
    Thanks in advance.

    Hi,
    I found you post the same question in other place and got the advice. I agree with Mr. Kees suggestion. The data type is a build-in default setting with Access, we can't change it. We may try the workaround via VBA to test.
    http://forums.cnet.com/7723-6129_102-627633/access-2010-change-default-formats-for-data-types/#message5617496
    Please Note: Since the web site is not hosted by Microsoft, the link may change without notice. Microsoft does not guarantee the accuracy of this information.
    Have a good time.
    Regards,
    George Zhao
    TechNet Community Support
    It's recommended to download and install
    Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
    programs.

Maybe you are looking for

  • More than 1 Hint in Select

    Hi Is possible put more than a hint in Select ? How can I do ?

  • Copying a project into development component project

    hiii, I have a webdynpro project called DP_OrderEntry developed in NWDS 7.0.9. I need to copy it into development component dc_OrderEntry in NWDS 7.0.14. Can anyone tellme the steps for doing it? Can any error can crop up due to the difference in the

  • Jsp vs servlets

    what advatages does jsp has over servlets.Example will be helpful

  • [SOLVED] synaptics touch pad

    so i got an EeePC 900A last night for my bday, aside from the problems i had getting started, trying out the factory install that didn't work at all, i'm loving. anyway, i got arch installed on it last night. and used the Xorg -config to generate a x

  • Der Application Builder startet nicht mehr. LabView bricht ab.

    Es lassen sich keine Projekte mehr öffnen. LabView 8.0 startet und bricht vollständig ab. Nach Neuinstallation der Installation 8.2.1, liegt der gleiche Fehler vor. Auch ein neues Projekt läßt sich nicht öffnen. Der Application Builder ist registrier