Jump to content
Xtreme .Net Talk

Recommended Posts

Posted (edited)

I am trying to subtract 2 dates in period Column

 

it works fine with Select Statement but

 

it will be meaning full if it works with Update Statement

 

also I wann subtract TotalDays from Period

 

can someone figure out what is my mistake in this script ?

 

 


UPDATE Vacation SET DateOfBack = ?, DateOfLeave = ?, 

LeaveKind = ?, MilitryNumber = ?, Period = ?, TotalDays = ? 

WHERE (VacationID = ?) AND (DateOfBack = ? OR ? IS NULL AND 

DateOfBack IS NULL) AND (DateOfLeave = ? OR ? IS NULL AND 

DateOfLeave IS NULL) AND (LeaveKind = ? OR ? IS NULL AND 

LeaveKind IS NULL) AND (MilitryNumber = ? OR ? IS NULL AND 

MilitryNumber IS NULL) AND (Period = DATEDIFF('d', DateOfLeave, 

DateOfBack) OR ? IS NULL AND Period IS NULL) AND (TotalDays = 

TotalDays - Period OR ? IS NULL AND TotalDays IS NULL)


Edited by Robby
Gary Says: To be a good programmer, you must be good at debugging

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...