Bug Found? cast doesnt work

  • Hi all

    Check this out, I dont know if im doing something wrong here but from all my experience with DBMS's this should not happen.. see below... can anyone repeat this?

    Microsoft SQL Server 2000 - 8.00.534 (Intel X86) Nov 19 2001 13:23:50 Copyright (c) 1988-2000 Microsoft Corporation Enterprise Edition on Windows NT 5.0 (Build 2195: Service Pack 2)

    select *

    from EIS_PI_Results

    where

    cast(PIResult_col2 as float) >= cast(6.0000 as float)

    and EISusername = UPPER('KEMPSC')

    and piname = UPPER('HR_TOTLEAVLIAB')

    --Server: Msg 8114, Level 16, State 5, Line 1

    --Error converting data type varchar to float.

    select *

    from EIS_PI_Results

    where

    EISusername = UPPER('KEMPSC')

    and cast(PIResult_col2 as float) >= cast(6.0000 as float)

    and piname = UPPER('HR_TOTLEAVLIAB')

    --Server: Msg 8114, Level 16, State 5, Line 1

    --Error converting data type varchar to float.

    select *

    from EIS_PI_Results

    where

    EISusername = UPPER('KEMPSC')

    and piname = UPPER('HR_TOTLEAVLIAB')

    and cast(PIResult_col2 as float) >= cast(6.0000 as float)

    -- THIS WORKS PERFECTLY !!!

    CREATE TABLE [EIS_PI_Results] (

    [EISUserName] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,

    [PIName] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,

    [PIResult_col1] [varchar] (600) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

    [PIResult_col2] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

    [PIResult_col3] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

    [PIResult_col4] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

    [PIResult_col5] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

    [PIResult_col6] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL

    ) ON [PRIMARY]

    GO


    Chris Kempster
    www.chriskempster.com
    Author of "SQL Server Backup, Recovery & Troubleshooting"
    Author of "SQL Server 2k for the Oracle DBA"

  • whoa...

    nows all queries are working? what the heck is going on here. Perhaps a bad proc cache entry?

    just chatted with another developer and tells me he had a similar thing a few days ago re parsing a query that was perfect.. 1hr later he tried again and parsed and executed fine.

    Thats it, im off home!

    Cheers

    Chris


    Chris Kempster
    www.chriskempster.com
    Author of "SQL Server Backup, Recovery & Troubleshooting"
    Author of "SQL Server 2k for the Oracle DBA"

  • Hi, i tested it on :Microsoft SQL Server 2000 - 8.00.194 (Intel X86)

    Aug 6 2000 00:57:48

    Copyright (c) 1988-2000 Microsoft Corporation

    Desktop Engine on Windows NT 4.0 (Build 1381: Service Pack 6)

    I did not get the error (all tree worked)

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply