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
 Other SQL Server Topics (2005)
 date

Author  Topic 

wided
Posting Yak Master

218 Posts

Posted - 2010-10-13 : 12:48:32

how can i have a name of a day

exemple

i want to have a result "Monday" if my var input is a date (11/10/2010)
thanks

PS: i need the result in frensh (Lundi)

pk_bohra
Master Smack Fu Yak Hacker

1182 Posts

Posted - 2010-10-13 : 12:55:25
select datename(dw,getdate()) --Friday
select datepart(dw,getdate()) --6


One way to get the name in frensh(Lundi) is using the case statement and substituting the value based on datename.

There may be other methods too. I need to check out on that.
Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2010-10-13 : 16:01:04
[code]set language french

select datename(dw,'11/10/2010') as DW[/code]

Results:
[code]DW
------------------------------
lundi[/code]

CODO ERGO SUM
Go to Top of Page

pk_bohra
Master Smack Fu Yak Hacker

1182 Posts

Posted - 2010-10-14 : 04:27:53
quote:
Originally posted by Michael Valentine Jones

set language french

select datename(dw,'11/10/2010') as DW


Results:
DW                             
------------------------------
lundi


CODO ERGO SUM



Cool..
I learned something new today.
Go to Top of Page

wided
Posting Yak Master

218 Posts

Posted - 2010-10-14 : 04:52:46
thanks

it is ok

this is what i need
Go to Top of Page
   

- Advertisement -