0
This question refers to this: How to return day of week and time formatted sql server 2008? I’m trying to fix it:
SELECT
CASE DATEPART(DW, GETDATE())
WHEN 1 THEN 'DOMINGO'
WHEN 2 THEN 'SEGUNDA'
WHEN 3 THEN 'TERCA'
WHEN 4 THEN 'QUARTA'
WHEN 5 THEN 'QUINTA'
WHEN 6 THEN 'SEXTA'
WHEN 7 THEN 'SABADO'
END DIASEMANA,
CONVERT(VARCHAR(05),GETDATE(),108) AS 'HORA',
* FROM TB_ESTRACAO
where DIASEMANA = 'S'
This method may even work (but beware of the return of this
datepart
DW pq may vary depending on config. ) but place of formatting date is in front end. In user view even for maintenance and localization/globalization– jean
Yes, there is no restriction of use in this case :)
– Marllon Nasser
@Marllonnasser, did you understand the question? I’m using the case result as a field in the table "Where DIASEMANA = ’S' ", this is not right.
– Harry
but never that
DIASEMANA
will be = ’S'. You can filter straight from theDATEPART
.where DATEPART(DW, GETDATE()) = 6
– Marllon Nasser
@Marllonnasser, in question I am referring to another question, where I have a table TB_ESTRACAO where in a column with the name of the day of the week, so I thought to use this way.
– Harry
The issue has already been resolved, I posted my solution in the other question that has a link in this.
– Harry
you doubled the question and answered the question itself. :|
– Marco Souza