Jump to content

SQL experts in Oka question


Recommended Posts

Posted

oka table lo two columns unnai : CreationDate/Due Date

 

 

 

Posted

Creation Date                                         DueDate

2020-05-07 21:59:03.787           2020-05-08 21:59:03.787

2020-05-07 21:43:13.787           2020-05-08 21:43:13.787          

2020-05-07 21:29:19.703           2021-05-08 21:29:19.703

 

how do i update the year in due date ( first two rows)

 

there are several rows, which i want the year to be updated

Posted

You wont get right answer if u cant explain ur qn  properly..

Posted
5 minutes ago, jefferson1 said:

Creation Date                                         DueDate

2020-05-07 21:59:03.787           2020-05-08 21:59:03.787

2020-05-07 21:43:13.787           2020-05-08 21:43:13.787          

2020-05-07 21:29:19.703           2021-05-08 21:29:19.703

 

how do i update the year in due date ( first two rows)

 

there are several rows, which i want the year to be updated

Use the primary key and alter table change date 

 

Posted
1 minute ago, Sarvapindi said:

You wont get right answer if u cant explain ur qn  properly..

where did i go wrong?

Posted

update  TABLE_name
set duedate =   dateadd( year, 1, duedate )
where year (duedate) = 2020

Posted
Just now, kevinUsa said:

Use the primary key and alter table change date 

 

got it bro,

thank you

Posted
9 minutes ago, jefferson1 said:

Creation Date                                         DueDate

2020-05-07 21:59:03.787           2020-05-08 21:59:03.787

2020-05-07 21:43:13.787           2020-05-08 21:43:13.787          

2020-05-07 21:29:19.703           2021-05-08 21:29:19.703

 

how do i update the year in due date ( first two rows)

 

there are several rows, which i want the year to be updated

https://stackoverflow.com/questions/10388351/how-to-change-only-the-year-of-a-date-datatype

Posted
Just now, jefferson1 said:

where did i go wrong?

Nee scenario complete ga explain chey man..ila table undhi..first 2 rows update cheyyali ante ela?.... requirement proper ga cheppu...otherwise the solutions u get now will work but screwup later..

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...