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 2000 Forums
 SQL Server Development (2000)
 INSERT dd/MM/yy format date without using CONVERT

Author  Topic 

simsimlhr
Starting Member

2 Posts

Posted - 2009-06-26 : 07:10:33
hi,
I have made a software in dot net 2005 (c#) and insert date into the database using format MM/dd/yy format. Now requirement of the client suddenly change , he wants date in the format dd/MM/yy, i have change the regional setting and it changes the display of the format in the sql server but when we insert dd/MM/yyyy(25/3/009) it gives error, is there any way out,
can we just change the setting of sql server 2000 and date is converted into dd/MM/yy???

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-06-26 : 07:18:49
The real and first question is "How are you inserting the data into SQL Server now?".



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

simsimlhr
Starting Member

2 Posts

Posted - 2009-06-26 : 08:31:03
I m inserting dd/MM/yy format date in the database For example 25/2/2009 format
using querry.



Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-06-26 : 10:01:35
HOW are you inserting it into the database?

Using dynamic sql? Stored procedure and command object?
Data table?

There are number of ways to insert data into database...



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

NeilG
Aged Yak Warrior

530 Posts

Posted - 2009-06-26 : 10:24:18
Are you meaning something like this

SELECT convert(char(10),getdate(),103)

but as peso says you really need to know how the data is being into the database first inorder to convert the date when its being inserted through the stored proc etc
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-06-26 : 11:08:21
Many calender controls have the .Value property which can be taken and set to a datetime parameter directly, without ANY conversion at all!



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-06-27 : 09:22:55
Always use YYYYMMDD HH:MM:SS format to avoid errors

Madhivanan

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

- Advertisement -