Getting Datename

Jan 8, 2007

i have a table names as dt which consists of dates for example there are 10 date records in my table, i want to find the name of that all 10 dates.


i used this:
Select DateName(weekday,'2007-01-08')
this gives monday, so i have 10 dates , i need to find the day of 10 dtes at a time
can any one please give me the query.

View 2 Replies


ADVERTISEMENT

DATENAME Function

Feb 24, 2008

hi, how doin ??
in fact i found a problem with DATENAME function. i execute this select to return the week number, i change only the year part, like that :

SELECT DATENAME(wk,'03/01/1993') --> Result = 2
SELECT DATENAME(wk,'03/01/1994') --> Result = 2
SELECT DATENAME(wk,'03/01/1995') --> Result = 1
SELECT DATENAME(wk,'03/01/1996') --> Result = 1
SELECT DATENAME(wk,'03/01/2000') --> Result = 2
SELECT DATENAME(wk,'03/01/2001') --> Result = 1
...... etc
the result must be '1', but i don't know why it returns '2'

can someone help me plz ??????? thank u

View 5 Replies View Related

DATEPART And DATENAME

Mar 30, 2008



Hi:

I am puzzled by the following:

If I execute "SELECT DATEPART(weekday, '20080330') as day_of_week", I get a result of 1 which makes sense since Sunday is usually considered the 1st day of the week.

However, if I execute "SELECT DATENAME(weekday, DATEPART(weekday, '20080330')" as day_of_week, I get a result of Tuesday!

Similarly, if I execute "SELECT DATENAME(weekday, 1) as day_of_week", I also get a result of Tuesday.

Can anyone explain what is happening here?

View 5 Replies View Related

DATENAME - Can You Not Get It To Say The Actual Day Name??

Jun 15, 2006

SELECT DATENAME(day, getdate()) AS 'Day Name'

comes back as 15 but i want it to come back with thursday

Cheers,
Craig

View 4 Replies View Related

How To Order Results From DateName?

Mar 13, 2008

HiI want to get the dateName of everything but I don't know how to sort them now. Like I have this:DateName(month,TimeDateStamp) As TimeDateStampWhat gets the dateName now I want to sort these so that they are in order.How do I do this?  

View 3 Replies View Related

Datename In Report Page Header

Nov 9, 2007

I'm trying to get the following sql to work in a textbox. I have select the textbox properties and it's value is
=datename(m,dateadd(m,-1,current_timestamp))

I would like the results of "October"

however I get the following error


The value expression for the textbox €˜textbox1€™ contains an error: [BC30451] Name 'datename' is not declared.



I'm pretty new to this so I do not know excatly what that error means.

Any help for me out there?

Thanks,
Cardgunner

View 11 Replies View Related

SQL Server Express 2005 Datename Error?

Oct 11, 2007

I was trying to return the month name in a query but didn't get the results that I expected. To demonstrate, I wrote this query:


SELECT GETDATE(), DATENAME(DAY,DAY(GETDATE()))

SELECT GETDATE(), DATENAME(MONTH, MONTH(GETDATE()))


and got this result:


----------------------- ------------------------------

2007-10-11 14:54:29.147 12

(1 row(s) affected)



----------------------- ------------------------------

2007-10-11 14:54:29.147 January

(1 row(s) affected)


Am I doing something wrong or is SQL Server doing something odd? I need to find a fix for this pretty quickly and any help would be greatly appreciated.

Thanks!

View 8 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved