TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Jes Sie
742
1.2k
280.4k
DATEDIFF combined with UPDATE STATEMENT
Aug 12 2018 9:50 PM
I have a query below:
select
DATEDIFF(
DAY
, DateRequested, GETDATE())
as
NumberOfDays
from
tblSeriesRequest
if the NumberOfDays is greater than 30, then I want to perform an update
UPDATE
[dbo].[tblSeriesRequest]
SET
[IsCancelled] = 1
I tried the query below but it updates the whole rows.
if exists(
select
1
from
tblSeriesRequest
where
(DATEDIFF(
DAY
, DateRequested, GETDATE())) > 30
and
IsApproved <> 1)
begin
UPDATE
[dbo].[tblSeriesRequest]
SET
[IsCancelled] = 1
end
Can anyone show me how to do this? Many thanks in advance
Reply
Answers (
4
)
Wpf reportviwer using xml as a l Datasource
Sign-In -- Your connection to this site is not private