copy and paste this google map to your website or blog!
Press copy button and paste into your blog or website.
(Please switch to 'HTML' mode when posting into your blog. Examples: WordPress Example, Blogger Example)
Get day of week in SQL Server 2005 2008 - Stack Overflow To get a deterministic value for the day of week for a given date you could use a combination of DATEPART () and @@datefirst Otherwise your dependent on the settings on the server
SQL DATEPART(dw,date) need monday = 1 and sunday = 7 You can tell SQL Server to use Monday as the start of the week using DATEFIRST like this: I would suggest that you just write the case statement yourself using datename(): when 'Monday' then 1 when 'Tuesday' then 2 when 'Wednesday' then 3 when 'Thursday' then 4 when 'Friday' then 5 when 'Saturday' then 6 when 'Sunday' then 7 end)
problema al obtener el numero del dia de la semana en sql server Si lo que quieres es una función (no sé si recomendarte) que retorne el día de la semana, sin considerar la respuesta anterior (la cuál es válida) Tendrías que hacer, por ejemplo: @FECHA DATETIME DECLARE @DIA INT = DATEPART(WEEKDAY, @FECHA) RETURN @DIA + CASE WHEN @DIA >= 2 THEN -2 ELSE 5 END DBO UDF_DIASEMANA('20180115'),
DATEPART (Transact-SQL) - SQL Server | Microsoft Learn Week and weekday datepart arguments For a week (wk, ww) or weekday (dw) datepart, the DATEPART return value depends on the value set by SET DATEFIRST January 1 of any year defines the starting number for the week datepart For example: DATEPART (wk, 'Jan 1, xxx x') = 1 where xxxx is any year