Odd query results

Mike Kerner MikeKerner at roadrunner.com
Wed Dec 14 21:58:11 EST 2016

I'd have to see your SQL, but how are you checking for null and empty?
Null is a funky value in SQL that can mean a variety of things, and an
empty value in an integer column will give you heartache.  WIth many
DBMS's, you have to check IS NULL or IS NOT NULL depending on the column
values and types.  See the syntax reference for the DBMS you are using.  If
I was in your position, 0 would be unassigned and -1 would be
decommissioned, the column would be set to NOT NULL, and a trigger would
set it to 0 if it IS NULL() for insert and for update.

On Wed, Dec 14, 2016 at 7:31 PM, Bob Sneidar <bobsneidar at iotecdigital.com>

> Hi all.
> I had an odd result from a query. First, I created a customer and site
> whose unique id's were 0 for a primary key autoincrementing column. I did
> this so that I can decommission devices by assigning 0 for their customer
> and site id's, and then find them later by selecting the customer ID 0.
> With me so far?
> Well when I queried for empty or null site id's I got the records whose
> siteid's are 0! 0 is not empty OR null. Is this what SQL is supposed to do?
> In other words, is 0 the same as NULL the same as Empty String? It's so
> obscure because the unique autoincrementing integers usually start with 1,
> NEVER 0.
> Sincerely,
> The BugMeister
> (Bob S)
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

On the first day, God created the heavens and the Earth
On the second day, God created the oceans.
On the third day, God put the animals on hold for a few hours,
   and did a little diving.
And God said, "This is good."

More information about the use-livecode mailing list