February 25, 2009 at 3:07 pm
i need help
to get all month Day of the Week
like this
CREATE FUNCTION dbo.udf_DayOfWeek(@dtDate DATETIME)
RETURNS VARCHAR(10)
AS
BEGIN
DECLARE @rtDayofWeek VARCHAR(10)
SELECT @rtDayofWeek = CASE DATEPART(weekday,@dtDate)
WHEN 1 THEN ‘Sunday’
WHEN 2 THEN ‘Monday’
WHEN 3 THEN ‘Tuesday’
WHEN 4 THEN ‘Wednesday’
WHEN 5 THEN ‘Thursday’
WHEN 6 THEN ‘Friday’
WHEN 7 THEN ‘Saturday’
END
RETURN (@rtDayofWeek)
END
GO
Call this function like this:
SELECT dbo.udf_DayOfWeek(GETDATE()) AS DayOfWeek
i try to like this
SELECT
dbo.udf_DayOfWeek(GETDATE()) AS day1 , dbo.udf_DayOfWeek(GETDATE()-2) AS day2,, dbo.udf_DayOfWeek(GETDATE()-3) AS day3
need help to create like ROW in clander
start month TO end of the month
and after need to put my date
like 02/2009
i get all the day of the Week
start month TO end of the month
(i must to use my language hebrew in the day name)
how ?
TNX
February 25, 2009 at 3:13 pm
You should take a look at the DateName function. It will return the name of the day of the week for you. And it'll be faster than the UDF.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
February 25, 2009 at 3:42 pm
how to do this ??
mydate= 02/2009
and get like this
fld1 |fld2 |fld3 fld29 | fld30 |fld31
sun mon Tue ..................... .............................null null null
mydate= 03/2009
i get like this
fld1 |fld2 |fld3 fld29 | fld30 |fld31
sun mon Tue ..................... sun mon Tue
how to do it
TNX
February 25, 2009 at 6:35 pm
HOw are you displaying your calendar? THis sounds like something that you should be using your application for displaying, not the SQL.
---------------------------------------------------------
How best to post your question[/url]
How to post performance problems[/url]
Tally Table:What it is and how it replaces a loop[/url]
"stewsterl 80804 (10/16/2009)I guess when you stop and try to understand the solution provided you not only learn, but save yourself some headaches when you need to make any slight changes."
February 25, 2009 at 11:24 pm
gpspocket (2/25/2009)
how to do this ??mydate= 02/2009
and get like this
fld1 |fld2 |fld3 fld29 | fld30 |fld31
sun mon Tue ..................... .............................null null null
mydate= 03/2009
i get like this
fld1 |fld2 |fld3 fld29 | fld30 |fld31
sun mon Tue ..................... sun mon Tue
how to do it
TNX
I'll make you a deal... no one ever tells us what the business reason behind doing something like this is. Tell us what the business reason is and I'll give you the code even if I think it's the wrong thing to do. Seriously...
--Jeff Moden
Change is inevitable... Change for the better is not.
February 26, 2009 at 12:06 am
... and, can it be an inline bit of code or do you really need it as a function?
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 6 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply