Re: Access SQL Text Comparisons

From: Date: Tue, 10 Oct 2000 17:52:33 +0000
Subject: Re: Access SQL Text Comparisons
References: 1 2  Groups: php.windows 
Request: Send a blank email to php-windows+get-3114@lists.php.net to get a copy of this message
Thanks, that did it. I was tearing my hair out trying to negotiate MS help screens (contradiction in terms). Derek ----- Original Message ----- From: "Pablo Vera" <pvz@vercan.com> To: "PHP Windows List" <php-windows@lists.php.net> Sent: Tuesday, October 10, 2000 6:21 PM Subject: Re: [PHP-WIN] Access SQL Text Comparisons > Derek: > > Access, by default, does not allow zero length strings, so your blank > fields are actually NULL values. When you perform a comparison with > NULL values the result is also a NULL and this is interpreted as FALSE > by the WHERE clause. I would recommend something like this: > > UPDATE table1, table2 SET table1.AMEND_VERSION_T = "1.2.1" > WHERE (table1.Code = table2.Code) OR > (isnull(table1.Code) AND isnull(table2.Code)); > > No need for the brackets in the WHERE clause, unless the table or > field names use special characters. > > Saludos, > Pablo Vera > _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > > Tuesday, October 10, 2000, 12:07:46 PM, Derek wrote: > > DP> For some reason I'm having trouble with an Access2000 SQL Update query > DP> (can't do it in PHP for techy reasons). > > DP> The comparison is between text fields and all is well if both have values > DP> and are equal. It doesn't match however if both fields are blank. > > DP> Record Field1 Field2 > DP> 1 A A Query correctly updates as equal > DP> 2 A B Query correctly ignores as different > DP> 3 Query incorrectly ignores even though > DP> equally blank > > DP> UPDATE table, table2 SET table1.AMEND_VERSION_T = "1.2.1" > DP> WHERE ([table1].[Code])=([table2].[Code]); > > DP> Using Like is still running after 20 minutes! > > DP> TIA > > DP> Derek > > > > -- > PHP Windows Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net > For additional commands, e-mail: php-windows-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.windows (#3114) next »