Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do i change the Month only, in a date/time field 1

Status
Not open for further replies.

DJB2

IS-IT--Management
May 16, 2005
1
NL
I have an SQL database with a date time field but i want to only change the Month part.
ie 10/12/2005 11:04:56 to 10/05/2005 11:04:56

can this be done using UPDATE?
eg.
Table name = tbl_StarterCallData
Field Name = scd_Arrival

Please help urgent.

regards DJ
 
I'm assuming your date is in DD/MM/YYYY format?

Code:
UPDATE tbl_StarterCallData
SET  scd_Arrival = Dateadd(Month,-7,scd_Arrival)
WHERE ....

Make sure you include the where clause so that you don't modify all the records (unless you want to).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top