Re: Update 'Date': Set Day(Date) to a Certain Number
- From: "David Portas" <REMOVE_BEFORE_REPLYING_dportas@xxxxxxx>
- Date: Wed, 4 Jan 2006 21:41:21 -0000
"PML" <PML@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:AA252BD5-DD93-4810-954D-FED5820E7B21@xxxxxxxxxxxxxxxx
> Hi,
>
> I am trying to use an update command to set the day of a date to a certain
> number. For example, if the date is 1/4/06, I might want to set day(date)
> to
> '7'. So it turns into 1/7/06. I wasn't sure if there was a way to do this
> and I keep getting errors when I try it.
>
> Thanks,
For example:
UPDATE tbl
SET dt = DATEADD(DAY,7-DAY(dt),dt)
WHERE ... ;
Where 7 is the date you want to set.
--
David Portas
SQL Server MVP
--
.
- Prev by Date: Re: SQL Query Help Please....(you guru's should know it).
- Next by Date: Re: How to select all top 1s from different group in a view
- Previous by thread: Re: SQL Query Help Please....(you guru's should know it).
- Next by thread: Re: Update 'Date': Set Day(Date) to a Certain Number
- Index(es):
Relevant Pages
|
|