Note: This question is part of a series of questions that use the same scenario. For your convenience,
the scenario is repeated in each question. Each question presents a different goal and answer choices,
but the text of the scenario is exactly the same in each question in this series.
You query a database that includes two tables: Project and Task. The Project table includes the following
columns:
You plan to run the following query to update tasks that are not yet started:
UPDATE Task SET StartTime = GETDATE() WHERE StartTime IS NULL
You need to return the total count of tasks that are impacted by this UPDATE operation, but are not associated
with a project.
What set of Transact-SQL statements should you run?

Explanation:
The WHERE clause of the third line should be WHERE ProjectID IS NULL, as we want to count the tasks that
are not associated with a project.
I agreee
26
0
It should be answer C; when you update a null value there is no deleted.
drop table dbo.task
create table task (projectid int, taskid int, starttime datetime2(7))
insert into dbo.task (projectid, taskid, starttime) values (10,1,null),(20,2,null)
update task set starttime = getdate() output deleted.starttime, inserted.starttime
To replay to question:
drop table dbo.task
create table task (projectid int, taskid int, starttime datetime2(7))
insert into dbo.task (projectid, taskid, starttime) values (10,1,getdate()),(20,2,null)
–answer c is good
declare @startedtasks table (taskid int)
update dbo.task set starttime = getdate() output inserted.taskid into @startedtasks where starttime is null
select count(*) from @startedtasks where taskid is not null
0
14