Below I've setup a practical illustration of why this matters. Using the exact same SQL query, the sum of payments is 100.00 when LANGUAGE is set to US_ENGLISH, but the sum is 300.00 for ITALIAN and FRENCH.
Thanks, Lynn, for pointing out that YYYYMMDD (not YYYY-MM-DD) is the correct format to use for LANGUAGE and DATEFORMAT setting independence. We have to remember that the application or client tool can apply these settings at the connection level, so it would be best to always use YYYYMMDD format in our SQL queries.
create table #customer_payment
( primary key( customer_id, payment_date),
customer_id int not null, payment_date datetime not null,
payment_amt smallmoney not null );
insert into #customer_payment
( customer_id, payment_date, payment_amt )
( 123, '20120112', 100.00 ),
( 123, '20120505', 100.00 ),
( 123, '20121207', 100.00 );
Then, run the following query under each language:
where customer_id = 123 and payment_date >= '2012-10-01';
SET LANGUAGE US_ENGLISH;
Changed language setting to us_english.
SET LANGUAGE ITALIAN;
L'impostazione della lingua è stata sostituita con Italiano.
Le paramètre de langue est passé à Français.
SET LANGUAGE FRENCH;
However, modifying the search condition to YYYYMMDD format like below, the query returns 100.00 under all three languages.
where customer_id = 123 and payment_date >= '20121001';
"The universe is complicated and for the most part beyond your control, but your life is only as complicated as you choose it to be."