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
 Site Related Forums
 The Yak Corral
 Date Conversions

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-01-12 : 08:34:16
John writes "I just wanted to thank someone for this.

convert(varchar, GETDATE(), 101). Saved me a lot of grief."

X002548
Not Just a Number

15586 Posts

Posted - 2005-01-12 : 09:00:18
Well...


SELECT CONVERT(varchar(10), GetDate(), 101)


Might be a little better...

EDIT: True...



Brett

8-)
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-01-12 : 09:01:23
bad brett bad...

Go with the flow & have fun! Else fight the flow
Go to Top of Page

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2005-01-12 : 09:26:58
SELECT convert(varchar, GETDATE(), 101) works fine though


Damian
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2005-01-12 : 09:31:38
True again...

But would you reccomend the practice?



SELECT '"'+ CONVERT(varchar(10), GETDATE(), 101) + '"'
UNION ALL
SELECT '"'+ CONVERT(varchar, GETDATE(), 101) + '"'
UNION ALL
SELECT '"'+ CONVERT(char, GETDATE(), 101) + '"'





Brett

8-)
Go to Top of Page

amachanic
SQL Server MVP

169 Posts

Posted - 2005-01-14 : 14:42:36
Everyone knows that Real SQL Hackers only use style 112.
Go to Top of Page
   

- Advertisement -