[Tutor] formatting sql Was: Some help Please

James Reynolds eire1130 at gmail.com
Wed Feb 15 19:51:00 CET 2012


On Wed, Feb 15, 2012 at 1:30 PM, Alan Gauld <alan.gauld at btinternet.com>wrote:

> On 15/02/12 18:03, James Reynolds wrote:
>
>  >    In you table the acc_id is 'mn0001'
>> >    In your sql Acc_ID = 'MN0001'
>> >    Why the difference in case?
>>
>> Normally, sql doesn't care about case with respect to table names. I
>> believe in certain implementations they are always lower case, even if
>> you pass an upper.
>>
>
> The issue is not the table (or even column name) its the value within it.
> Comparing 'mn0001' to 'MN0001' will fail.
>
> --
> Alan G
> Author of the Learn to Program web site
> http://www.alan-g.me.uk/
>
>
> ______________________________**_________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/**mailman/listinfo/tutor<http://mail.python.org/mailman/listinfo/tutor>
>


I think this depends on the settings of the column and what you have set in
your sql statement.

Example:

if ('j' = 'J')
select 'True'
else
select 'False'

This comes out True

if ('j' = 'k')
select 'True'
else
select 'False'

This comes out False

I suppose this could be by implementation, but at least in sql server, I
think Oracle, and maybe some others, you have to set the database (or
column) to case sensitive by changing it through a collation statement.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20120215/0e5aa67e/attachment.html>


More information about the Tutor mailing list