I want to update date

Posted by Nuwan under ASP.NET on 5/30/2012 | Points: 10 | Views : 974 | Status : [Member] | Replies : 5
Dear All,

I want to update date in sql with asp project.Im using this query
UPDATE FORCAST SET F_DUEDATE = DAY(1) WHERE (F_CONTRACT = 'hpky000190') AND (F_SERIAL BETWEEN '1' AND '10')


But Day update Like this.
Ole Date = 9/18/2008
Updated Date = 1/19/1900 12:00:00 AM

Bt I want to that date updated like 9/19/2008.

Please help me.

Rathnayake


Responses

Posted by: Gaur1982 on: 5/30/2012 [Member] Starter | Points: 25

Up
0
Down
Here you want to add one day in the given date so you can use DATEADD funtion of SQL

Syntax : DATEADD (datepart , number , date )

Example : SELECT DATEADD(day, 1, '9/18/2008')

Output : 9/19/2008

Gaurav Agrawal
http://www.planetofcoders.com/

Nuwan, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: CGN007 on: 5/30/2012 [Member] Silver | Points: 25

Up
0
Down
@Gaur1982

Output is 2008-09-19 00:00:00.000

Nuwan, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Gaur1982 on: 5/30/2012 [Member] Starter | Points: 25

Up
0
Down
yap that's right answer which you want.....

Gaurav Agrawal
http://www.planetofcoders.com/

Nuwan, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Nuwan on: 5/30/2012 [Member] Starter | Points: 25

Up
0
Down
yes , its work. But this method date add in day. like my date is 5 i want to update it 10 I want to add 5 day. like 5+5=>10.
Bt i want my days is 5 if i want to update in 10 like 5=>10.
Because I use ajax calender controller in this programme. Please help.


Rathnayake

Nuwan, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ajay.Kalol on: 5/30/2012 [Member] Starter | Points: 25

Up
0
Down
Try this

select convert(varchar,getdate() + 1,101) as 'Day'


Put Your Date Instead of getdate()


Enjoy

Ajay
ajaypatelfromsanthal.blogspot.in

Nuwan, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response