Re: NULL Records

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Jacco Schalkwijk (jacco.please.reply_at_to.newsgroups.mvps.org.invalid)
Date: 09/30/04


Date: Thu, 30 Sep 2004 12:17:42 +0100

I don't think that the fact that your column is named KEY is the cause of
the NULL values. But you can avoid NULL values and duplicate values
altogether by creating a Primary Key on the column. That will probably cause
the application that tries to insert the NULL values to crash, but then at
least you know where they come from and you can try to fix the code.

-- 
Jacco Schalkwijk
SQL Server MVP
"rick" <rick@discussions.microsoft.com> wrote in message 
news:F0F08F87-46BF-472E-8005-66532ACBD8A6@microsoft.com...
> Jacco your a hero.  That was what was wrong.  I just didn't know how to 
> make
> SQL think KEY was a column and not something else.  So thank you very 
> much.
> One last thing.  Do you think it is a problem that I have a column named 
> KEY.
> Is that why I could be getting these null records.  Thanks again.
>
> "Jacco Schalkwijk" wrote:
>
>> Is the column that you have in your table called KEY?
>>
>> In that case you have to use delimiters around your column name because 
>> KEY
>> is a reserved keyword in T-SQL. Delimiters can be either square brackets
>> ([..]) or double quotes ("..."). For example
>>
>> DELETE FROM <table_name> WHERE [KEY] IS NULL
>>
>> -- 
>> Jacco Schalkwijk
>> SQL Server MVP
>>
>>
>> "rick" <rick@discussions.microsoft.com> wrote in message
>> news:63A09A7D-F4DD-4C8F-8FD8-2FBD9D632B10@microsoft.com...
>> > That was the code I was writing, but it kept giving me an error say 
>> > syntax
>> > was wrong after KEY.   Where KEY is the column name.   Thanks
>> >
>> > "Jacco Schalkwijk" wrote:
>> >
>> >> DELETE FROM <table_name> WHERE <column_name> IS NULL
>> >>
>> >> <column_name> is the column with the NULL values.
>> >>
>> >> -- 
>> >> Jacco Schalkwijk
>> >> SQL Server MVP
>> >>
>> >>
>> >> "rick" <rick@discussions.microsoft.com> wrote in message
>> >> news:9D293DE1-2FFC-4231-B9FB-5FB470911D63@microsoft.com...
>> >> >I am having a problem with our sql database.   We keep getting NULL
>> >> >records
>> >> > in some of our tables.  It has not been a problem until today when 
>> >> > we
>> >> > got
>> >> > two
>> >> > NULL records and now I am having a problem deleting them.  I am 
>> >> > getting
>> >> > an
>> >> > error saying KEY Column information is insufficient or incomplete. 
>> >> > Too
>> >> > many
>> >> > rows affected by update.  I know I am getting this since both of the
>> >> > records
>> >> > are the same, but I can't find out how to delete them.  I tried to
>> >> > write a
>> >> > script in the QA, but the column that I need to search under is 
>> >> > called
>> >> > KEY.
>> >> > Is this my problem, or could it be something else.  Thanks for the
>> >> > help.
>> >>
>> >>
>> >>
>>
>>
>> 


Relevant Pages

  • Re: NULL Records
    ... In that case you have to use delimiters around your column name because KEY ... Jacco Schalkwijk ... >> SQL Server MVP ... >>> error saying KEY Column information is insufficient or incomplete. ...
    (microsoft.public.sqlserver.server)
  • Re: NULL Records
    ... Jacco Schalkwijk ... SQL Server MVP ... "rick" wrote in message ... > error saying KEY Column information is insufficient or incomplete. ...
    (microsoft.public.sqlserver.server)
  • Re: How can I control execution wait time within a stored procedure?
    ... "Ken Sturgeon" wrote in message ... Any pointers you might have to articles, ... > "Jacco Schalkwijk" ... >> SQL Server MVP ...
    (microsoft.public.sqlserver.programming)
  • Re: ORDER BY CASE failure on Computed Field
    ... "charles" wrote in message ... > "Jacco Schalkwijk" ... >> SQL Server MVP ... >>> WHEN 'NumPosts' THEN NumPosts ...
    (microsoft.public.sqlserver.programming)
  • Re: Duplicate Entries Help
    ... > Since there are up to 20 rows per DMCUSERID and per CHARTPERIODID I ... > "Jacco Schalkwijk" ... >> WHERE EXISTS(SELECT NULL FROM userchartentry u1 ... >> SQL Server MVP ...
    (microsoft.public.sqlserver.server)