|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Monday, April 29, 2013 2:17 PM
Points: 8,
Visits: 21
|
|
Hey All
I am new to SQL development and come from a help desk background. This is one of my first projects and I am stuck. My out come would be to use the- SELECT DATEPART(WEEKDAY, GETDATE())- into a current table I have set up. The following code attached is what I am working with. My outcome would be to create another column next to my results with numeric values next to the dates. I am stuck by only getting the current date but I would like it to go for my whole selected date range. Any help is appreciated. This screen shot was from yesterday so I understand today would be 4 and so on.
Steve
SELECT * FROM ##salesdays
EXCEPT
SELECT date FROM dbo.csta_non_working_days
SELECT DATEPART(WEEKDAY, GETDATE())
This gives me the following results below in the image.

|
|
|
|
|
Old Hand
      
Group: General Forum Members
Last Login: Wednesday, February 20, 2013 9:40 AM
Points: 358,
Visits: 2,775
|
|
Hi try this,
SELECT dateRange,DATEPART(WEEKDAY,dateRange)as Week_day from ( SELECT dateRange FROM ##salesdays EXCEPT SELECT date FROM dbo.csta_non_working_days ) as t
Thanks & Regards, MC
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Monday, April 29, 2013 2:17 PM
Points: 8,
Visits: 21
|
|
Thank you very much. This was the fix I needed. Thank you again.
Steve
|
|
|
|