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
 General SQL Server Forums
 New to SQL Server Programming
 convert and replace

Author  Topic 

h2sut
Starting Member

40 Posts

Posted - 2008-03-20 : 11:13:13
cast([Birthdate]as datetime) [Birthdate], 01/12/2001

I have created this query below to change it to the format mmddyyyy.
I not sure were the birthdate goes at in this query.

replace(convert(varchar(10), getdate(), 101), '/', '')

elancaster
A very urgent SQL Yakette

1208 Posts

Posted - 2008-03-20 : 11:16:28
well, birthdate would replace getdate() ...but can i ask why? is it just presentation?

Em
Go to Top of Page

jhocutt
Constraint Violating Yak Guru

385 Posts

Posted - 2008-03-20 : 11:16:40
replace getdate() with BIRTHDATE

"God does not play dice" -- Albert Einstein
"Not only does God play dice, but he sometimes throws them where they cannot be seen."
-- Stephen Hawking
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2008-03-20 : 11:17:14
Do not convert at all in SQL Server, just return the raw DATETIME value to your client application and do all the formatting you want there. That is the way databases and client tools were designed to interact.

- Jeff
http://weblogs.sqlteam.com/JeffS
Go to Top of Page

h2sut
Starting Member

40 Posts

Posted - 2008-03-20 : 11:22:49
Thanks for your help. To answer your question the client wants in the format of mmddyyy for export file.

Thanks again for you help

quote:
Originally posted by elancaster

well, birthdate would replace getdate() ...but can i ask why? is it just presentation?

Em

Go to Top of Page
   

- Advertisement -