Link to home
Start Free TrialLog in
Avatar of AZZA-KHAMEES
AZZA-KHAMEESFlag for Bahrain

asked on

Day/Month/Year date changed to Month/Day/Year in SQL

Hi Experts
i have an old Classic ASP application that have a form to add record with Day/Month/Year format, when the date entered as 23/06/2015 in SQL will be added correctly as 23/06/2015 but when date entered as 01/06/2015 : 1st june 2015 in SQL will be added as 06/01/2015 which will be incorrect
i searched the net for the solution for that and found this article
INF: How to Set the Day/Month/Year Date Format in SQL Server

but when i tried to run this query to configure the database
exec sp_addlanguage 'British', 'English',
   'January,February,March,April,May,June,July,August,September,October,
   November,December',
      'Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec',
   'Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday',
   dmy,1
   sp_configure 'default language', 1
   reconfigure with override

Open in new window


i am getting an error message:
Msg 102, Level 15, State 1, Line 11
Incorrect syntax near 'sp_configure'.

can you please help me in solving this issue
thank you
ASKER CERTIFIED SOLUTION
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
and I doubt it's necessary for you need to do the configuration as posted in your question above.
You can directly use Dateadd to adjust the date like
SELECT DATEADD(month, 1, '2006-08-30');
SELECT DATEADD(month, 1, '2006-08-31');

Open in new window

Avatar of AZZA-KHAMEES

ASKER

Thank you for the reply, yes i modified my code, and it worked :) thank you again