Specify datatype in sql as

In my query I have Select 1235 as 'Integer_Field' from Table.
Is there a way to specify that 1235 is an integer here?
I'm connecting to oracle through asp.net and when I populate a DataTable, it's assuming this is a string field, then sorting doesn't work correctly because it's trying to sort a string field instead of an integer.
Thanks

Hi,
Rich75 wrote:
In my query I have Select 1235 as 'Integer_Field' from Table.You're not really using single-quotes there, are you? Double-quotes, maybe,
Is there a way to specify that 1235 is an integer here?
I'm connecting to oracle through asp.net and when I populate a DataTable, it's assuming this is a string field, then sorting doesn't work correctly because it's trying to sort a string field instead of an integer.
ThanksThat sounds like an ASP problem, not an Oracle problem. Oracle knows that 1235 is a NUMBER, not a VARCHAR2. if it didn't, you could use CAST:
SELECT  CAST ('1235' AS NUMBER)  AS integer_field
FROM    table_x;

Similar Messages

  • Date datatype in SQL*LOADER

    Hi guys,
    How do we use DATE datatype in SQL*LOADER

    Hi,
    I was just wondering if you've resolved this error. I want to know because we're experiencing the exact same error right now.
    Thanks.
    Regards,
    _lilim

  • Set out of range value to a time datatype in sql server 2008

    Hi,
    I have a variable set to time datatype in SQL server 2008. I need to set a value more than 24 hrs to that. Is there any way? I get an error like Conversion failed when converting date and/or time from character string. .Below is my scenario
    declare @QuietBeginTime time
    SET @QuietBeginTime  = (SELECT value FROM #RCQD where id=8)
    ---------This has a value like '24:45'
    Print @QuietBeginTime
    Please help me.
    Deepa

    declare @QuietBeginTime time
    SET @QuietBeginTime  = (SELECT value FROM #RCQD where id=8)
    ---------This has a value like '24:45'
    Print @QuietBeginTime
    Above is my scenario. Your example is fine, But main thing is i want to set a value to a variable, That
    i am unable to do
    Deepa

  • How to set datetime datatype in sql server simultaneously

    Hi,
    How can I set date and time simultaneously in datetime field in sql server 2000 using jdbc.
    Thanks

    Actually I'm using datetime datatype in sql server.
    and when I set date than only date gets stored while
    when I set time only time gets stored in database.Hey buddy, go and read the API. In Timestamp your problem will be take care of.

  • Member acces profile error(A table name, specified in an sql command)

    Hi friends,
    In my bpc application(A) below 3 dims are secure dims.
    1. entiiy  (std)
    2. category (std)
    3. location (custom dim)
    while defining one member access profile,
    Read Only      : CATEGORY 100
    Read & Write      : CATEGORY 200,500
    for whatever combinatio i use, for other secure dims (eg: category,location where base member,or parent members ) i'm getting below error  message
    A table name, specified in an sql command, is unknown.
    We are on bpc75nw sp04.
    Pls suggest us .
    dump(st22):
    Short text
        A table name, specified in an SQL command, is unknown.
    What happened?
        Error in the ABAP Application Program
        The current ABAP program "CL_UJE_MEMACCESS_CACHE========CP" had to be
         terminated because it has
        come across a statement that unfortunately cannot be executed.
    Error analysis
        An exception occurred that is explained in detail below.
        The exception, which is assigned to class 'CX_SY_DYNAMIC_OSQL_SEMANTICS', was
         not caught in
        procedure "REMOVE_MEMACCESS" "(METHOD)", nor was it propagated by a RAISING
         clause.
        Since the caller of the procedure could not have anticipated that the
        exception would occur, the current program is terminated.
        The reason for the exception is:
        An invalid table name "/1CPMB/RDWCSUMAS" was specified in an Open SQL command:
        Due to one of the following reasons, the error occurs only at runtime:
        - the table name was specified dynamically, or
        - the SELECT clause, WHERE clause, GROUP-BY clause, HAVING clause, or
          ORDER-BY clause was specified dynamically.
    Thanks,
    naresh
    Edited by: Naresh P on Feb 19, 2011 10:40 AM

    Hi Naresh,
    As far as I know You have specify Explicit Access to all the dimensions mentioned as Secured in your Application.
    You can't skip the secured Dimesions.
    In your case if you want to restrict only one dimension for 1 Member Access Profile then give Read & Write access to other 2 Dimensions and select ALL members.
    This might solve your problem.
    Hope it helps.
    Chaithanya

  • CF FORM SPECIFIED PRICE RANGE - SQL

    I have the following form but dont know the CF QUERY SQL. I
    am trying to list all books within a user specified price range but
    having trouble with the cf query sql, any help much appricated! ; )

    Try this,
    Change the radio buttons to all have the same name and id,
    also change the values to the actual values
    <input class="optionbutton" type="radio" value="="
    id="comparison" name="comparison" checked="checked" /><label
    for="comp1">equal to</label><br />
    <input class="optionbutton" type="radio" value=">"
    id="comparison" name="comparison" /><label
    for="comp2">greater than</label><br />
    <input class="optionbutton" type="radio" value=">="
    id="comparison" name="comparison" /><label
    for="comp3">greater than or equal to</label><br />
    <input class="optionbutton" type="radio" value="<"
    id="comparison" name="comparison" /><label
    for="comp4">less than</label><br />
    <input class="optionbutton" type="radio" value="<="
    id="comparison" name="comparison" /><label
    for="comp5">less than or equal to</label>
    SELECT book.title as book, book.price, book.isbn,
    author.forename, author.surname, category.title as category
    FROM Category INNER JOIN (Author INNER JOIN Book ON
    Author.AuthorID = Book.AuthorID) ON Category.CategoryID =
    Book.CategoryID
    <!--- zero equals zero, just in case the radio button is
    not passed --->
    WHERE 0=0
    <!--- make sure that the radio button is defined --->
    <cfif IsDefined("form.comparison")>
    AND book.price #form.comparison# #form.price#
    </cfif>
    Ken

  • Need advise - compare specified date in *.sql with sysdate.

    Hi Guys,
    Need help here.
    Anyone has a script that will compare the specified date with the current sysdate. If earlier, it will order SQL*PLUS to quit immediate.
    Basically the checking will be in a *.sql script. Whenever we run the script, @c:\script.sql, it will first compare the dates and decide whether to proceed with the rest of the codes (dml) below the date checker in the same script.sql
    thanks

    Hi,
    I'm not sure I understood as it seems too simple to me:
    set serveroutput on
    DECLARE
       v_date   DATE := TO_DATE('&yourdate', 'YYYYMMDD');
    BEGIN
       IF v_date >= TRUNC(SYSDATE)
       THEN
         /* Your DML statements here */
         DBMS_OUTPUT.PUT_LINE('Code is executed');
       ELSE
         DBMS_OUTPUT.PUT_LINE('Date is before SYSDATE.');
       END IF;
    END;
    EXIT
    {code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Could not resolve the connect identifier specified - only in sql jobs

    windows 2008 R2 64 bit
    Sql Server 2008 R2 64 bit
    Oracle 11g R2 client 64bit
    I'm getting the 'ORA-12154: TNS:could not resolve the connect identifier specified' when I'm trying to execute a stored procedure that calls this linked server from a sql server agent job. I can execute the stored procedure perfectly fine in a query window. Any help or suggestions would be greatly appreciated.
    A little more info. The client install on this machine wasn't pretty. I think there might be multiple homes leading to confusion of which tnsnames.ora file the different elements are looking for. Anyway to verify this?
    Edited by: 907427 on Oct 7, 2012 7:38 PM

    windows 2008 R2 64 bit
    Sql Server 2008 R2 64 bit
    Oracle 11g R2 client 64bit
    I'm getting the 'ORA-12154: TNS:could not resolve the connect identifier specified' when I'm trying to execute a stored procedure that calls this linked server from a sql server agent job. I can execute the stored procedure perfectly fine in a query window. Any help or suggestions would be greatly appreciated.
    A little more info. The client install on this machine wasn't pretty. I think there might be multiple homes leading to confusion of which tnsnames.ora file the different elements are looking for. Anyway to verify this?
    Edited by: 907427 on Oct 7, 2012 7:38 PM

  • Trying to serialize C# object and store as XML Datatype in Sql Server 2005

    using
    if (Obj != null)
                   MemoryStream stream = new MemoryStream();
                   StreamWriter writer = new StreamWriter(stream);
                   XmlSerializer x = new XmlSerializer(Obj.GetType());
                   x.Serialize(writer, Obj);
                   writer.Close();
                   byte[] arr = stream.GetBuffer();
                   return Encoding.UTF8.GetString(arr).Trim();
    The object looks like
        public class CorporateBondSec : BaseSecurity
            public double coupon; // CPN
            public string couponType; // CPN_TYPE
            public int couponFreq; // CPN_FREQ
            public string floater; // FLOATER
            public int resetFreq; //REFIX_FREQ
            public DateTime resetDate; //NXT_REFIX_DT              
            public DateTime firstCpnDate; //FIRST_CPN_DT
    XML looks like
    '<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<CorporateBondSec xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">\r\n  <coupon>8</coupon>\r\n  <couponType>FIXED</couponType>\r\n  <couponFreq>2</couponFreq>\r\n  <floater>N</floater>\r\n  <resetFreq>0</resetFreq>\r\n  <resetDate>0001-01-01T00:00:00</resetDate>\r\n  <firstCpnDate>0001-01-01T00:00:00</firstCpnDate>\r\n</CorporateBondSec>'
    Error from SQL
    Msg 9413, Level 16, State 1, Procedure procSecuritiesInsert, Line 0
    XML parsing: line 1, character 15, A string literal was expected
    I have also tried
    XmlSerializer x = new XmlSerializer(Obj.GetType());
    System.Text.StringBuilder builder = new System.Text.StringBuilder();
    x.Serialize(XmlWriter.Create(builder), Obj);
    return builder.ToString();
    That gives me an XML
    '<?xml version=\"1.0\" encoding=\"utf-16\"?>
    <CorporateBondSec xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">
    <coupon>8</coupon>
    <couponType>FIXED</couponType>
    <couponFreq>2</couponFreq>
    <floater>N</floater>
    <resetFreq>0</resetFreq>
    <resetDate>0001-01-01T00:00:00</resetDate>
    <firstCpnDate>0001-01-01T00:00:00</firstCpnDate>
    </CorporateBondSec>'
    Error
    Msg 9413, Level 16, State 1, Procedure procSecuritiesInsert, Line 0
    XML parsing: line 1, character 15, A string literal was expected

    Tony,
    this is how your XML should look like.
    Code Snippet
    '<?xml version="1.0" encoding="utf-16"?>
    <CorporateBondSec xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <coupon>8</coupon>
    <couponType>FIXED</couponType>
    <couponFreq>2</couponFreq>
    <floater>N</floater>
    <resetFreq>0</resetFreq>
    <resetDate>0001-01-01T00:00:00</resetDate>
    <firstCpnDate>0001-01-01T00:00:00</firstCpnDate>
    </CorporateBondSec>'
    I see you have a few extra '\' characters before double quotes. you need to remove them.

  • Question about the text datatype in SQL server 2008 r2

    How do I read/write this datatype to/from the database using C#? (visual studio 2010) I am not sure how to handle it.

    Go to Tools/Designers and uncheck this option (see the image). Also, instead of executing the change right away, click on the script option and examine the proposed change. SSMS often makes changes script more difficult than it needs to be.
    For every expert, there is an equal and opposite expert. - Becker's Law
    My blog
    My TechNet articles

  • How to convert Oracle User defined datatype to SQL Server 2014 using SSMA Version 6.0

    I am trying to convert Oracle 11g OE schema to SQL Server 2014, using SSMA version 6.0
    Getting an error in converting the Oracle View to SQL Server
    CREATE OR REPLACE VIEW OC_CUSTOMERS OF OE.CUSTOMER_TYP WITH OBJECT IDENTIFIER (customer_id) AS
    SELECT c.customer_id, c.cust_first_name, c.cust_last_name, c.cust_address,
               c.phone_numbers,c.nls_language,c.nls_territory,c.credit_limit,
               c.cust_email,
               CAST(MULTISET(SELECT o.order_id, o.order_mode,
                                   MAKE_REF(oc_customers,o.customer_id),
                                   o.order_status,
                                   o.order_total,o.sales_rep_id,
                                   CAST(MULTISET(SELECT l.order_id,l.line_item_id,
    l.unit_price,l.quantity,
    MAKE_REF(oc_product_information,
    l.product_id)
    FROM order_items l
    WHERE o.order_id = l.order_id)
                                        AS order_item_list_typ)
                             FROM orders o
                             WHERE c.customer_id = o.customer_id)
                    AS order_list_typ)
         FROM customers c
    *   SSMA error messages:
    *   O2SS0461: Conversion of object view is not supported.
    *   OF OE.CUSTOMER_TYP
    *      WITH OBJECT IDENTIFIER (customer_id)
    CREATE VIEW dbo.OC_CUSTOMERS
    AS
       /*Generated by SQL Server Migration Assistant for Oracle version 6.0.0.*/
       *   SSMA error messages:
       *   O2SS0481: Conversion of statement containing user defined type column 'c.cust_address' not supported.
       *   O2SS0481: Conversion of statement containing user defined type column 'c.phone_numbers' not supported.
       *   O2SS0430: Conversion of multiset conditions is not supported.
       *   CAST(MULTISET
       *      SELECT
       *         o.order_id,
       *         o.order_mode,
       *         MAKE_REF(oc_customers, o.customer_id),
       *         o.order_status,
       *         o.order_total,
       *         o.sales_rep_id,
       *         CAST(MULTISET
       *               SELECT
       *                  l.order_id,
       *                  l.line_item_id,
       *                  l.unit_price,
       *                  l.quantity,
       *                  MAKE_REF(oc_product_information, l.product_id)
       *               FROM order_items  l
       *               WHERE o.order_id = l.order_id
       *            ) AS order_item_list_typ)
       *      FROM orders  o
       *      WHERE c.customer_id = o.customer_id
       *   ) AS order_list_typ)
       SELECT
          c.CUSTOMER_ID,
          c.CUST_FIRST_NAME,
          c.CUST_LAST_NAME,
          c.cust_address,
          c.phone_numbers,
          c.NLS_LANGUAGE,
          c.NLS_TERRITORY,
          c.CREDIT_LIMIT,
          c.CUST_EMAIL,
          NULL
       FROM dbo.CUSTOMERS  AS c   */
    Any suggestion on converting this view would be helpful.
    Kind regards.

    Thanks Lydia Zhang for your reference urls.
    Please let me know if you come across any reference articles related to
    Creating a SQL Server table and View with columns as SQL Server TVP similar to Oracle UDT like
      CREATE TABLE "OE"."CUSTOMERS"
       (    "CUSTOMER_ID" NUMBER(6,0),
        "CUST_FIRST_NAME" VARCHAR2(20 BYTE) CONSTRAINT "CUST_FNAME_NN" NOT NULL ENABLE,
        "CUST_LAST_NAME" VARCHAR2(20 BYTE) CONSTRAINT "CUST_LNAME_NN" NOT NULL ENABLE,
        "CUST_ADDRESS" "OE"."CUST_ADDRESS_TYP" ,
        "PHONE_NUMBERS" "OE"."PHONE_LIST_TYP" ,
        "NLS_LANGUAGE" VARCHAR2(3 BYTE),
    And also creating a SQL Server TVP inside an another SQL Server TVP as in Oracle
    create or replace TYPE customer_typ
     AS OBJECT
        ( customer_id        NUMBER(6)
        , cust_first_name    VARCHAR2(20)
        , cust_last_name     VARCHAR2(20)
        , cust_address       cust_address_typ
       , credit_limit       NUMBER(9,2)
        , cust_email         VARCHAR2(30)
        , cust_orders        order_list_typ
    NOT FINAL;
    Kind regards.
    Venkatesha

  • Converting 99999999 to date datatype through sql/ssis

    Hi,
    I am developing an ETL in which we get this column which holds the value 99999999 in one of the columnwhich is of numeric datatype. User wants that field to be date time in destination. Please help me on how to convert that value into date datatype in SSIS.
    Please........

    Thank you Rajen,
    But I have used Collasce to solve this issue.
    COALESCE
    (NULLIF(t1.dtetrm,
    '99999999')
    ,'20991231')

  • XSL transform question from XML date datatype to SQL date datatype

    Just to give an idea, I am reading some employee information in a CSV format and I have created the fileadapter to read it and parse it into coherent information where each comma separated value corresponds to a column in an employee table. One of the columns is of the date object in the database.
    So my my variable is created with a list of employees and then fed into the invoke that calls a dbadapter that does the insert. I am using a transformation to get the values from one variable into the other simply because of namespace conflicts. However the xml date will not match the sql date object as to be expected...but how do I work around it? I have a few ideas but I am not sure they are worth mentioning.
    Any suggestions?

    @@Version : ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    Microsoft SQL Server 2012 - 11.0.5058.0 (X64)
        May 14 2014 18:34:29
        Copyright (c) Microsoft Corporation
        Developer Edition (64-bit) on Windows NT 6.2 <X64> (Build 9200: ) (Hypervisor)
    (1 row(s) affected)
    Compatibility level is set to 110 .
    One of the limitation states - XML columns with a depth of more than 128 nested nodes
    How do i verify this ? Thanks .
    Rajkumar Yelugu

  • The specified instance of SQL Server is hosted by a system that is not a WSFC node

    I am trying to setup always on availability group sql 2012 on 2 sql servers. When i try to add the replica, it gives me this error

    Hi JonDoe,
    According to your error message, it seems that you had two separate clusters. And you try to add secondary replica on the separate cluster. AlwaysOn Availability Groups requires a Windows Server Failover Clustering (WSFC) cluster and each availability replica
    of a given availability group must reside on a different node of the same WSFC cluster.
    There is similar issue about setting up availability group, you can review the following article.
    http://social.msdn.microsoft.com/forums/en-US/625a3cbe-0d8b-4d0f-ab1e-9751ce475d29/setting-up-availability-group
    Reference: http://msdn.microsoft.com/en-us/library/ff877884.aspx
    Regards,
    Sofiya Li
    Sofiya Li
    TechNet Community Support

  • Specifying initialization SQL for a connection pool

    Hi,
    I am having a locale problem with my application server and oracle database server. I would like to issue an "ALTER SESSION SET NLS_LANG= ..."
    Is there any way to specify an initialization SQL or any other recommentations from internationalization perspective.
    Thanks in advance

    It's ok I found the answer to connection pooling at http://www.developer.com/db/print.php/10920_2172891_3 if anyone is interested.
    Cheers!
    James

Maybe you are looking for

  • Viewing the Source on external monitor

    Hello I and using Premiere Pro 6 on a Mac Pro with a Decklink Extreme HD card. I can view the Program on the external monitor through my Decklink card without a problem but when I switch to Source monitor I can't. I regularly did this in Final Cut Pr

  • How to rotate a Video in WindowsPhone 8.1 Silverlight

    Hi, Let me explain my problem. I want to record video without shutter sound, so i choice CaptureSource  instead of MediaCapture. With MediaCapture i can set SetPreviewRotation(VideoRotation) to change to rotate of video, the problem is with CaptureSo

  • I can't select my phone number for iMessage (-sigh- Yeah, this problem again)

    Let me explain the whole scenario: My iMessage and FaceTime worked perfectly fine this morning. I turned off my iMessage to check if I would be able to get messages from other iPhones. My observation is that when an iPhone has their iMessage turned o

  • Cannot Save Preference??? (EAR4)

    I cannot save preference for every and all settings in the Tools --> Preferences. When I changed some values, click OK and open the preference again, all the old values re-appear.... Is that preference cannot save at this moment???

  • Tool Tips

    I was wondering if there was a way to make the tool tips have multiple lines of text. I tried creating a string with \n for line breaks and it seemed to do nothing. thank you!