Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Default Date format

Status
Not open for further replies.

keenanbr

Programmer
Oct 3, 2001
469
IE
Is there a way to set the default date format.
I have to enter

set dateformat mdy

each time
 
The user options setting of sp_configure allows server-wide settings and works across multiple databases. This setting also behaves like an explicit SET statement, except that it occurs at login time.


So... Try something like

USE master
EXEC sp_configure 'set dateformat mdy'
RECONFIGURE WITH OVERRIDE



 
Server: Msg 15123, Level 16, State 1, Procedure sp_configure, Line 78
The configuration option 'set dateformat mdy' does not exist, or it may be an advanced option.

Valid configuration options are:
 
If it's an advanced option you need to run it like this:

EXEC SP_CONFIGURE 'SHOW ADVANCED OPTION', '1'
GO
RECONFIGURE
GO
EXEC SP_CONFIGURE 'SET DATEFORMAT MDY'
GO
RECONFIGURE
GO

You can get a list of advanced options by running this;
EXEC SP_CONFIGURE 'SHOW ADVANCED OPTION', '1'
GO
RECONFIGURE
GO
EXEC SP_CONFIGURE

Refer to the BOL, use the Index tab and enter SP_CONFIGURE. Choose the SP_CONFIGURE Transact-SQL option. In there you will also see a link for Setting Configuration Options. Check out that also.

You might need to set the options to ALLOW UPDATES

EXEC SP_CONFIGURE 'ALLOW UPDATES', '1'
GO

Check this all out in the BOL as it makes changes to the system tables.

-SQLBill
BOL = Books OnLine = Microsoft SQL Server's Help
Installed as part of the Client Tools
Found at Start>Programs>Microsoft SQL Server>Books OnLine
 
I tried :

EXEC SP_CONFIGURE 'SHOW ADVANCED OPTION', '1'
GO
RECONFIGURE
GO
EXEC SP_CONFIGURE 'SET DATEFORMAT MDY'
GO
RECONFIGURE
GO

Got :

DBCC execution completed. If DBCC printed error messages, contact your system administrator.
Configuration option 'show advanced options' changed from 1 to 1. Run the RECONFIGURE statement to install.
Server: Msg 5808, Level 16, State 1, Line 1
Ad hoc updates to system catalogs not recommended. Use the RECONFIGURE WITH OVERRIDE statement to force this configuration.
Server: Msg 15123, Level 16, State 1, Procedure sp_configure, Line 78
The configuration option 'SET DATEFORMAT MDY' does not exist, or it may be an advanced option.

Valid configuration options are:

Server: Msg 5808, Level 16, State 1, Line 1
Ad hoc updates to system catalogs not recommended. Use the RECONFIGURE WITH OVERRIDE statement to force this configuration.

Anyone got ant ideas
 
Run this:

EXEC SP_CONFIGURE 'SHOW ADVANCED OPTION', '1'
GO
RECONFIGURE
GO
EXEC SP_CONFIGURE

That will give you a list of the advanced options. Maybe LogicMagic has it wrong and SET DATEFORMAT dmy is not an advanced option.

-SQLBill
 
The solution, for anyone interested, was to change the language setting in ODBC. Thanks to all for you replies.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top