rich
3/21/2007 7:39:00 PM
Thanks very much for this correction. Now it makes sense.
One more question - I noticed that a lot of code statemetns that people
share end with a semicolon. Is that semicolon typed by you or is there a
tool you are using that puts the semicolon at the end of the statement? If
it is a tool, is it a tool that comes with sql server? or is just the
scripting tool?
"Aaron Bertrand [SQL Server MVP]" wrote:
> >I think I figured this out
> >
> > SELECT datename(week,'1/10/04')
>
> That's not weekday, that returns 2 because it is the second week of 2004
> (note: according to SQL Server, not necessarily the same as ISO).
>
> I think you mean DATEPART(WEEKDAY, ...)
>
> Also you should try to avoid ambiguous date formats. If you meant January
> 10th, then say so.
>
> SELECT DATEPART(WEEKDAY, '20040110');
>
> If you want to return Saturday instead of 7, then:
>
> SELECT DATENAME(WEEKDAY, '20040110');
>
>
>