Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Isthere any function in T-SQL to get day of week using? Expand / Collapse
Author
Message
Posted Saturday, April 1, 2006 4:26 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Thursday, July 24, 2014 4:20 AM
Points: 54, Visits: 23

I've found that there is a function called "trftime" in Sqlite. However, I cannot find any function like this in T-SQL. Is there any function to do this?

 

Post #270355
Posted Saturday, April 1, 2006 5:07 AM


SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: Today @ 8:25 AM
Points: 4,983, Visits: 11,675

Like this? I don't know SQLLite.

select datepart(dw, getdate())




Help us to help you. For better, quicker and more-focused answers to your questions, consider following the advice in this link.

When you ask a question (and please do ask a question: "My T-SQL does not work" just doesn't cut it), please provide enough information for us to understand its context.
Post #270358
Posted Saturday, April 1, 2006 4:24 PM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Wednesday, July 9, 2014 9:37 AM
Points: 2,553, Visits: 567
Unless you're looking for..

datename(dw, getdate())..?!?!

Since the datepart is dependent on the current setting of "datefirst"...check that first if that's the one you want..








**ASCII stupid question, get a stupid ANSI !!!**
Post #270380
Posted Wednesday, October 12, 2011 1:11 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, October 12, 2011 1:07 PM
Points: 1, Visits: 0
If you only want to get the day index, you should check the following description:
MS SQL: Day of Week
Post #1189402
Posted Thursday, October 13, 2011 3:49 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Friday, December 30, 2011 2:24 AM
Points: 15, Visits: 29
perhaps use convert e.g. convert(varchar, xdate,101)
Post #1189695
Posted Thursday, October 13, 2011 2:31 PM
Say Hey Kid

Say Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey Kid

Group: General Forum Members
Last Login: Monday, April 7, 2014 11:41 AM
Points: 703, Visits: 4,519
don't know sqlite... it would be helpful if you describe what the function does and give an example.
Post #1190203
Posted Monday, October 31, 2011 10:13 AM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Wednesday, July 23, 2014 4:30 PM
Points: 76, Visits: 290
Were you able to find an equivalent function in SQL?
Post #1198190
Posted Monday, October 31, 2011 10:02 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 8:06 PM
Points: 36,786, Visits: 31,243
kpao (4/1/2006)


I've found that there is a function called "trftime" in Sqlite. However, I cannot find any function like this in T-SQL. Is there any function to do this?


You really do need to tell us what that does. Are you looking for a numeric day of the week, a 3 letter name of the day of the week, or the full name of the day of the week?


--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #1198437
Posted Monday, October 31, 2011 10:05 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 8:06 PM
Points: 36,786, Visits: 31,243
ulfemsoy (10/12/2011)
If you only want to get the day index, you should check the following description:
MS SQL: Day of Week


You don't need a UDF for this...

 SELECT (DATEDIFF(dd,'17530101',GETDATE())-1) %7



--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #1198438
Posted Monday, October 31, 2011 10:27 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 8:06 PM
Points: 36,786, Visits: 31,243
BWAA-HAAA!!! I just realized the original question is from 5 years ago and the OP is probably long gone.

--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #1198440
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse