The 5 First SQL Errors to Check For

  • deleted

  • My Best error (I have lots) was

    SELECT * FR0M MyTable

  • The worst type of errors are the are not really errors at all, but rather user misunderstandings about SQL functionality (or just typos made in haste) that compile, run with no problem in QA and Production, but ultimately produce an unintended result.

    It's usually the accounting department who discover the problem at month end.

    create table mytable


    col_datetime datetime not null,

    col_int int null,


    insert into mytable ( col_datetime, col_int )

    values ('2011-01-31 02:45PM', NULL );

    select count(*) count_null from mytable where col_int = null;




    select count(*) as count_january from mytable

    where col_datetime between '2011-01-01' and '2011-01-31';




    declare @col_int int = 1;

    update mytable set @col_int = col_int;

    (1 row(s) affected)

    col_datetime col_int

    ----------------------- -----------

    2011-01-31 14:45:00.000 NULL

    "Do not seek to follow in the footsteps of the wise. Instead, seek what they sought." - Matsuo Basho

Viewing 3 posts - 46 through 47 (of 47 total)

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