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
 Transact-SQL (2000)
 DATE FORMAT

Author  Topic 

sajis79
Starting Member

3 Posts

Posted - 2005-05-25 : 00:49:11
HOW TO INSERT DATE IN DD-MM-YYYY FORMAT?
HOW TO RETRIVE DATE IN DD-MM-YYYY FORMAT?
I AM USING SQL SERVER 2000

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-05-25 : 01:47:00
set dateformat dmy

declare @t table(d datetime)
insert into @t values('12-05-2005')
select convert(varchar(20),d,105) from @t


Madhivanan

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

DonAtWork
Master Smack Fu Yak Hacker

2167 Posts

Posted - 2005-05-25 : 09:50:34
nononononono

insert the dang date.
return the dang date.

LET THE CLIENT FORMAT IT!!!!!11!!!!1!!!!!!eleventyone!!


*need more coffee*
Go to Top of Page

_Raclede_
Starting Member

3 Posts

Posted - 2005-05-25 : 20:49:43
quote:
Originally posted by DonAtWork

nononononono

insert the dang date.
return the dang date.



madhivanan answer was correct.. it will give a DD-MM-YYYY FORMAT..
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2005-05-25 : 22:05:39
>>madhivanan answer was correct

Actually, Don is correct. Don't do you formatting with SQL Server. Ever. That date value is now a VARCHAR being returned. Your database layer should return values not formatted text strings.

- Jeff
Go to Top of Page
   

- Advertisement -