Error on select when using value converted from varchar to integer (with isnumeric in where)

Hi,
Why is it, that when I convert a varchar into integer and filter it to numeric only that I get the Error 'Conversion failed when converting the nvarchar value '...' to data type int.'
Here is a short SQL witch shows the Error:
create table tTest(ID int, sText nvarchar(15))
insert into tTest
select 1, null
insert into tTest
select 2, 'q'
go
select distinct ID, sText, convert(int,sText) AS ID2 from tTest where isnumeric(sText) = 1
go
SELECT DISTINCT TOP 100 PERCENT
ID
FROM
(select distinct ID, sText, cast(sText as int) AS ID2 from tTest where isnumeric(sText) = 1) v1
WHERE
id2 = 1
go
drop table tTest
As a workaround I replaced the case with 'cast(case when isnumeric(sText) = 1 then sText else null end as int)', but this rater unexpected.
It works fine in a short query, but if I create a view with the SQL from V1 then the error is unexpected, since I only know that if I view the source of the view

>'cast(case when isnumeric(sText) = 1 then sText else null
ISNUMERIC is not 100% accurate.
BOL: "ISNUMERIC returns 1 for some characters that are not numbers, such as plus (+), minus (-), and valid currency symbols such as the dollar sign ($). For a complete list of currency symbols, see money and smallmoney (Transact-SQL)."
LINK: http://technet.microsoft.com/en-us/library/ms186272.aspx
ISNUMERIC examples:
http://sqlusa.com/bestpractices/isnumeric/
Kalman Toth Database & OLAP Architect
Free T-SQL Scripts
New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

Similar Messages

  • Error ORA-06502 When using function REPLACE in PL/SQL

    Hi,
    I have a PL/SQL procedure which gives error 'Error ORA-06502 When using function REPLACE in PL/SQL' when the string value is quite long (I noticed this with a string 9K in length)
    variable var_a is of type CLOB
    and the assignment statement where it gives the error is
    var_a := REPLACE(var_a, '^', ''',''');
    Can anyone please help!
    Thanks

    Even then that shouldn't do so:
    SQL> select overload, position, argument_name, data_type, in_out
      2  from all_arguments
      3  where package_name = 'STANDARD'
      4  and object_name = 'LPAD'
      5  order by 1,2
      6  /
    OVERLOAD   POSITION ARGUMENT_NAME                  DATA_TYPE                      IN_OUT
    1                 0                                VARCHAR2                       OUT
    1                 1 STR1                           VARCHAR2                       IN
    1                 2 LEN                            BINARY_INTEGER                 IN
    1                 3 PAD                            VARCHAR2                       IN
    2                 0                                VARCHAR2                       OUT
    2                 1 STR1                           VARCHAR2                       IN
    2                 2 LEN                            BINARY_INTEGER                 IN
    3                 0                                CLOB                           OUT
    3                 1 STR1                           CLOB                           IN
    3                 2 LEN                            NUMBER                         IN
    3                 3 PAD                            CLOB                           IN
    4                 0                                CLOB                           OUT
    4                 1 STR1                           CLOB                           IN
    4                 2 LEN                            NUMBER                         INI wonder what happened?

  • Error message "Quantity could not be converted from GA to"

    Error message "Quantity could not be converted from GA to" gets displayed when i update any condition value/type ZMET in VA02 transaction.
    Where we need to maintain "Alternative unit of measure for the material"
    Plz do the needful. Points rewarded
    Regards,
    Sathish

    Dear Sathish
    Go to material master, select "Additional Data" tab.  There select "Units of measure" and maintain the alternative unit of measure and save.  Now retry.
    thanks
    G. Lakshmipathi

  • Drop down menus on iPad, the first selection in the drop down will not load as a selection when using safari, what can I do?

    Drop down menus on iPad, the first selection in the drop down will not load as a selection when using safari, what can I do?  I use this for my mobile, on-site auto repair business and not being able to call up repair and diagnostic info and reference for some cars is troublesome for sure. It works fine on the computer and I have installed a remote desktop app as a workaround but it is unreliable because the desktop is not business dedicated and may be off or in use at the time. So is there a known fix for this?
    Let me paint a more descriptive picture, visualize 4 drop down selection menus, first one is for year, next one is for make, 3rd one is model and the last one is for engine size/type. If I wanted to choose a 2012 vehicle it wont work because it is the top selection on the list. This can be forced by selecting any other year and then coming back to 2012. Ok fine, but then let's say I wanted to choose Acura as the make, well it won't take it because again it's the top selection. Again you work around it be selecting any other make and coming back to Acura. Ok now select the model, same trend follows. But now since most Acura vehicles come with dedicated engines and no optional engines I have only 1 selection in that final drop down menu and it will not take my selection and therefore never let me proceed to the info I need.
    This is also true when ordering parts from my wholesaler's website, they use drop downs and I can only get to that last drop down and then I'm stuck. This is blindingly frustrating, what options do I have. I'm not opposed to any avenue at this point.

    Did you ever figure this out? I bought my iPad last week to use in my business as well. I assume you are trying to use alldata? That is where I noticed this same issue. I had problems with identifix working with safari but downloaded a different browser and that works fine. Alldata does not work with either browser. The main difference is that on identifix if there is only one engine selection, it automatically selects the only option and continues to the home page. With alldata you have to make the selection manually even if there is only one option. Honestly if I can't get this to work I am going to return the iPad as it looses a significant amount of usefulness to men

  • There are error message "No such interface supported" when play Audio/Media from USB thumb disk with Metro APP like Xbox.

     There are error message "No such interface supported" when play Audio/Media from USB thumb disk with Metro APP like Xbox in windows. how can I solve this problem?   if I use destop player like windows media player, no such error.
    would you please give some solution for this error? thanks!

    OS is window10, Metro APP is Xbox or MultiMedia 8; any video format will occur error only by following steps:  
    a. Put Audio / Media / Photo files into USB thumb disk or Micro SD card.
    b. Connect USB thumb disk / Micro SD Card  to Platform.
    c. Open 'File Explorer', click USB thumb disk.
    d. Open audio file with metro app: Music. / Open Media file with metro app: Video./Open Photo file with metro app.

  • "Internal Error Occurred" appears when .pdf is opened from Outlook 2010 email

    "Internal Error Occurred" appears when .pdf is opened from Outlook 2010 email
    I am absolutely pulling out my hair over this one!!
    PC/Win 7 64bit/Adobe XI/Office 2010
    I have tried Uninstalling and re-installing
    I have tried using an adobe software removal tool
    I have tried modifying the security settings in reader
    I've tried running repair on MS Office
    If you open the .pdf from an email directly, it opens Reader with the error "Internal Error Occurred"
    If you drag and drop the .pdf onto the desktop, and then open it, it opens.
    If you open Adobe Reader FIRST, then open the .pdf from the email, it opens fine.
    ONLY when you open a .pdf from an email with Adobe Reader closed (so Outlook is asking AR to open first, and then present the .pdf) is it behaving this way.
    Hypothesis: Outlook 2010 does not like to open Adobe Reader.
    SO....tell me all of you brilliant geniuses? How do I solve this puzzle and become an end user's hero?
    PS: WorkAround - the only work around I have found for this at present, is that the user first opens up Adobe Reader and lets it run in the background. I pinned the shortcut to his task bar to remind him.

    I have uninstalled Adobe Acrobat Reader DC and installed Adobe Reader XI and everything works fine. This will be our current fix until a solution is found for the above error

  • Error 1074396120 appears when using IMQA copy

    error 1074396120 appears when using IMQA copy,when i used in vision its working but when i tried to execute in labview its showing error image not found and not valid image. pls help me regarding this .

    Have a look
    Thanks and Regards
    Himanshu Goyal | LabVIEW Engineer- Power System Automation
    Values that steer us ahead: Passion | Innovation | Ambition | Diligence | Teamwork
    It Only gets BETTER!!!

  • Get ORA-01031: insufficient privileges error, but only when using dbstart.

    I am getting ORA-01031: insufficient privileges error, but only when using dbstart. the listener starts but not the database. How come I can start it from SQL prompt but not from dbstart scripts as the oracle user?
    [oracle@mallard bin]$ ./dbstart
    Processing Database instance "gf44": log file /prod/oracle/10/startup.log
    [oracle@mallard bin]$
    Log file:
    Wed Aug 20 10:15:02 CDT 2008
    SQL*Plus: Release 10.2.0.1.0 - Production on Wed Aug 20 10:15:02 2008
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    SQL> ERROR:
    ORA-01031: insufficient privileges
    SQL> ORA-01031: insufficient privileges
    SQL>
    /prod/oracle/10/bin/dbstart: Database instance "gf44" warm started.
    >
    oratab file:
    gf44:/prod/oracle/10:Y
    dbstart file section:
    # See if it is a V6 or V7 database
    VERSION=undef
    if [ -f $ORACLE_HOME/bin/sqldba ] ; then
    SQLDBA=svrmgrl
    VERSION=`$ORACLE_HOME/bin/sqldba command=exit | awk '
    /SQL\*DBA: (Release|Version)/ {split($3, V, ".") ;
          print V[1]}'`
    case $VERSION in
    "6") ;;
    *) VERSION="internal" ;;
    esac
    else
    if [ -f $ORACLE_HOME/bin/svrmgrl ] ; then
    SQLDBA=svrmgrl
    VERSION="internal"
    else
    SQLDBA="sqlplus /nolog"
    fi
    fi
    Permissions of file:
    [oracle@mallard bin]$ ls -la dbstart
    -rwxrwxr-x 1 oracle oinstall 10407 Aug 19 12:27 dbstart
    [oracle@mallard bin]$
    User permissions:
    [root@mallard 10]# id oracle
    uid=503(oracle) gid=503(oinstall) groups=503(oinstall),504(dba)
    [root@mallard 10]#
    I can start the listener manually using "./lsnrctl start" and start the database manually from sql prompt using "SQL>startup" (as sysdba) with no problems. this only happens when using dbstart file. I am logged in as oracle user and all environment variables are set
    Thank you for any help you could provide.

    I have the same problem, but i don't want insert this string
    Connect sys/{password} as sysdbaI have deployed an Oracle 10g with os SunOS
    $ uname -a
    SunOS DB02 5.10 Generic_141444-09 sun4v sparc SUNW,Sun-Blade-T6320
    I can connect with sys/password, but I can't login with
    $ sqlplus /nolog
    SQL*Plus: Release 10.2.0.1.0 - Production on Thu Jan 7 15:19:50 2010
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    SQL> connect / as sysdba
    ERROR:
    ORA-01031: insufficient privilegesthe the startup and dbshut don't work.
    Someone maybe help me?
    Thanks,
    Regards.
    Lain

  • The bullet list, numbered list and the normal text is not converting when I am converting from RH 9 to MS Word 2010

    Hi all,
    Greetings for the day
    I am created a new CSS in Robohelp 9. I have also created a new template in Word 2010. The style sets for different information elements like (Heading, bullets, body text, ) are more or less same between the CSS and the new templates. I am also able to map the .css styles to Word template when I am converting from RH to Word as I am getting the necessary option in the drop-down list.
    However, when the output is generated, the bullet, the numbered list and the body text is not converting at all. The body text works sometimes. However, the numbered list and bullet list is coming out as images.
    If anybody knows the solution, I can share the .css and Word template.
    Thanks in advance.
    Regards,
    Parag Deb

    Create a new project with two or three topics containing lists of both types. Generate a printed output that shows the problem. Then zip it up and send it to me. See the Contact page on my site for instructions.
    See www.grainge.org for RoboHelp and Authoring tips
    @petergrainge

  • HT201335 What causes the TV screen to freeze but sound continue on TV when using Air Play from I Phone?

    What causes TV screen to freeze but sound continue on TV when using Air Play from I Phone 4?

    First try rebooting ATV and router. Beyond that, it's probably something within the network, typically interference.
    To get a report of the network go to istumbler (Mac) or netstumbler (PC). Look for signal strength and noise.
    If on wifi try ethernet.

  • After 9.3 update getting error printing to Adobe PDF while converting from Powerpoint to PDF

    That happened after upgrading Acrobat Pro 9.1.2 to 9.2->9.3 on Windows XP sp2 platform. Converting from other Microsoft Office 2003 products is totally normal(Excel, Word) Did anyone came accross and know how to fix that?? We have many users with exactly same issue.

    thanks...figured out my problem!
    Date: Wed, 3 Feb 2010 12:24:29 -0700
    From: [email protected]
    To: [email protected]
    Subject: Re: After 9.3 update getting error printing to Adobe PDF while converting from Powerpoint to PDF
    What happens if you try to print to the Adobe PDF printer?
    >

  • Hi there , Why Do I Receive Error Code -1073807253 When Using VISA

    Error Code -1073807253

    Hi ahmed,
    you can attach picture directly in the forum...
    If you would use an error indicator you could read an explanation of the error. It's a "framing error", happening sometimes when using serial connections...
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • What is the best way to display errors to users when using JSPs?

              Hello,
              Could someone suggest me the best way to display errors to users when using JSPs?
              Many thanks in advance.
              Rino
              

              Thanks for the code snippet!
              Rino
              "Deepak Vohra" <[email protected]> wrote:
              >
              >
              >The 'errorPage' attribute of the 'page' directive forwards uncaught run-time
              >exceptions
              >to an error processing page. For example:
              >
              ><%@ page errorPage="error.jsp" %>
              >
              >redirects the browser to the JSP page error.jsp if an uncaught exception
              >is encountered.
              >
              >
              >Within error.jsp, indicate that it is an error-processing page, via the
              >directive:
              >
              >
              >
              ><%@ page isErrorPage="true" %>
              >
              >The Throwable object describing the exception may be accessed within
              >the error
              >page via the 'exception' implicit object.
              >
              >
              ><% if (exception != null) { %>
              ><p> An exception was thrown: <b> <%= exception %>
              >
              ><p> With the following stack trace:
              ><pre>
              >
              ><%
              > ByteArrayOutputStream ostr = new ByteArrayOutputStream();
              > exception.printStackTrace(new PrintStream(ostr));
              > out.print(ostr);
              >%>
              ></pre>
              >
              >
              >
              >"Rino Srivastava" <[email protected]> wrote:
              >>
              >>Hello,
              >>
              >>Could someone suggest me the best way to display errors to users when
              >>using JSPs?
              >>
              >>Many thanks in advance.
              >>
              >>Rino
              >
              

  • How to convert  from  varchar to blob ?

    How to convert from varchar to blob ?
    thanks

    Here is a small PL/SQL block that we have used to convert varchar2 to blob.
    declare
    cursor get_blob is
    select blob_statement
    from report
    where report_id = 205
    FOR UPDATE OF blob_statement;
    v_loc blob;
    v_raw_buffer raw(32767);
    v_amount binary_integer := 32767;
    v_offset binary_integer := 1;
    v_buffer VARCHAR2(32767);
    begin
    open get_blob;
    fetch get_blob into v_loc;
    close get_blob;
    v_buffer := 'Sample text';
    v_raw_buffer := utl_raw.cast_to_raw(v_buffer);
    v_amount := utl_raw.length(v_raw_buffer);
    dbms_lob.write(v_loc, v_amount, v_offset, v_raw_buffer);
    commit;
    end;

  • Does Microsoft support disks which have been converted from MBR to GPT with third-party tools?

    Before opening a ticket with Microsoft to get the official response, does Microsoft support disks which have been converted from MBR to GPT with third-party tools?
    We have various disks on Windows Server 2008 R2 fileserver cluster that are all MBR with various mount points added to overcome the 2TB limitation on MBR disks.  Due to the time involved in physically moving the 30Tb+ of data to GPT disks, I would
    like to investigate the option of a lossless conversion tool. Does anybody have any experience of these in production environments that could comment?
    Any advice and details of experiences would be really appreciated!
    CRM Advisor

    Hi,
    Besed on my research, Microsoft supports a fileserver cluster if the disks have been converted from MBR to GPT using a third-party tool.
    For more detailed information, please refer to the links below:
    Convert MBR to GPT
    https://social.technet.microsoft.com/Forums/en-US/3007346f-cf7b-4089-9628-36d394da8240/convert-mbr-to-gpt
    Change a Master Boot Record Disk into a GUID Partition Table Disk
    http://technet.microsoft.com/en-us/library/cc725671.aspx
    Best Regards,
    Mandy 
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact [email protected]

Maybe you are looking for

  • When someone calls....how do you make the photo show in a small square?

    In the commercials for the iphone, when someone calls, the phone defaults to the wallpaper (in the commercials its most often the photo of earth) and the photo of the person is a small square in the upper right corner. When people call me, the photo

  • G5, Dell 30 inch monitor, Radeon Mac9600 PRO 256MB

    When I ordered this monitor, I read that my computer should have a dual-link DVI-D compatible graphics card. I had a dual-link DVI card, but soon found that the one I had didn't support the higher resolution of the 30 inch monitor. Apparently, the on

  • Can we define a Procedure in a Package Body without Defining in a Specifica

    Hi, Can we define a Procedure in a Package Body without Defining in a Specification,, if yes then how...,Please provide me some examples Please helpme out.... Regards Nikhil

  • Premiere Pro, Edit Original ... How? Metadata?

    Greetings! I've been given a project that's a mess in After Effects. Think of it as a Power Point slide show, but done in After Effects. I decided to export all of the slides as MOVs and edit them in Premiere. I love the "Edit Original" feature as I

  • Notes icon

    I accidentally deleted my notes icon. How do I get it back along with the notes I had stored?