changing all the dates in a database

P

Pat

I have to update a database by changing the year. Is
there a way I can do it without changing every record
manually?
Thanks,
Pat
 
B

bzamfir

Hi,

You can use an update query, like this

Update YourTable set DateFld = dateserial(YourNewYear, month(DateFld),
day(datefld))

This query will change year for all dates from field DateFld to YourNewYear

If you want, for example, to change all years to three years after current
year in the field, try this

Update YourTable set DateFld = dateserial(year(DateFld) + 3, month(DateFld),
day(datefld))

If you have more questions, you can contact me.

Good luck,
Bogdan

____________________________________
Independent Consultant
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top