473,394 Members | 1,889 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

how to update DATE column in a table

hai guys,

i want to update the date in a table like i just want to update the year of the of thie date in table for example if rows are like this, 2006-5-14 00:00:00,2005-4-14 00:00:00
then i want to make the year of all rows to 2007, can any one post the update query for this statement
Oct 5 '07 #1
2 2540
azimmer
200 Expert 100+
hai guys,

i want to update the date in a table like i just want to update the year of the of thie date in table for example if rows are like this, 2006-5-14 00:00:00,2005-4-14 00:00:00
then i want to make the year of all rows to 2007, can any one post the update query for this statement
Expand|Select|Wrap|Line Numbers
  1. update myTable
  2. set myDate='2007-'+RIGHT('0'+MONTH(myDate),2)+'-'+RIGHT('0'+DAY(myDate),2)
  3.  
Oct 5 '07 #2
I just needed to perform the same change on the year and it worked great, thanks for posting the script. I now need to perform the same change on the month only. Can someone please help with this. Thanks a bunch
Jan 8 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: S.Patten | last post by:
Hi, I have a problem with updating a datetime column, When I try to change the Column from VB I get "Incorrect syntax near '942'" returned from '942' is the unique key column value ...
3
by: rrh | last post by:
I am trying to update a field in one table with data from another table. The problem I'm running into is I need to base the update on a range of data in the 2nd table. Table 1 has: date field...
8
by: Maxi | last post by:
There is a lotto system which picks 21 numbers every day out of 80 numbers. I have a table (name:Lotto) with 22 fields (name:Date,P1,P2....P21) Here is the structure and sample data: ...
4
by: Jeremy | last post by:
My app is throwing an exception regarding trying to post a null to a required field. Examining the datarow in question, I see a valid date value. The row's state is "added" I'm relying on an ...
6
by: eclypz | last post by:
Whe i use a combobox, and i want it to update it's value i use the code ME.cbxname.Requery How can i do that to update the value of a textbox? i have already try to use the same expression,...
16
by: Ian Davies | last post by:
Hello Needing help with a suitable solution. I have extracted records into a table under three columns 'category', 'comment' and share (the category column also holds the index no of the record...
1
by: JeremyGrand | last post by:
I've read what's available here, but can't seem to make this work right. I'm experimenting with components on a form, although I'd rather create the pieces & assemble them in code, but that's...
4
by: =?Utf-8?B?QmFidU1hbg==?= | last post by:
Hi, I have a GridView and a SqlDataSource controls on a page. The SqlDataSource object uses stored procedures to do the CRUD operations. The DataSource has three columns one of which -...
8
by: frenzic | last post by:
Hi I am a DBA - just been in the job two weeks and I would be grateful for some help. I am trying to update a table with values from another table. I have spent two days on this and I think...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.