Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Get Server Date Format

Author  Topic 

tjoppie
Starting Member

4 Posts

Posted - 2008-04-15 : 16:31:22
Hi all,

I'm getting alot of date converstion trouble with my application when the end user's regional settings is not the same as the sql server box... I am using normal sqlcommands to enter my data into the sql db (vb.net), and alot of times I get users who's application breaks, because of this.

My question is... Is there some T-SQL command in sql server which will tell me the date formats it expects?

What I want to do then is query the server for these settings on startup of my application, and then set my application to use that date format for all it's date functions... This way, I'll eliminate the errors my application has to deal with.

Any ideas?

Thanks

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-04-15 : 16:48:04
Always use proper datatype (datetime, smalldatetime) when you make conversation with the database.
And, for some reason, you must use varchar/string make sure the date "format" is ISO-style YYYYMMDD.



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

Artoo
Starting Member

16 Posts

Posted - 2008-04-16 : 02:40:00
I send dates to SQL Server as '02 Mar 2008', which ensures the correct date and is much better than '02/03/2008'
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-04-16 : 03:16:08
quote:
Originally posted by Artoo

I send dates to SQL Server as '02 Mar 2008', which ensures the correct date and is much better than '02/03/2008'


It maynot work properly if the Language of the Server is not English. As said send date in YYYYMMDD format to work in all date settings

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -