datename

datename

 

  

Gurus,
When I use the "datename" function to extract the day of year from a
datestamp is there a way to get the date back out of the output?

example:

declare @date int,
@date2 int

set @date = (SELECT DATENAME(dy, getdate()))

set @date2 = @date -1

select @date2

I need to create a date stamp ( in yyyy-mm-dd 00:00:00.000 ) format from
this output.

Does anyone know how to accomplish this?

TIA,

-steveb
MS Sql Server LazyDBA home page