Bhoomi
Bhoomi

Reputation: 80

Update status column where status is null

Anyone can help in query

I want to fetch one by one record from startdate to enddate in the table and update one by one record from the table

Like I am having one table Temp

ID   DATE          Status
1    2011-09-10      WO
2    2011-09-11      WO
3    2011-09-12     NULL
4    2011-09-13     NULL
5    2011-09-14     NULL
6    2011-09-15      H

Now i need the output like below when i used give startDate and enddate then Status which have NULL value should get 'L'

ID   DATE          Status
1    2011-09-10      WO
2    2011-09-11      WO
3    2011-09-12       L
4    2011-09-13       L
5    2011-09-14       L
6    2011-09-15      H

Upvotes: 0

Views: 1229

Answers (1)

Aaron Bertrand
Aaron Bertrand

Reputation: 280431

Why do you have to do this "one by one"?

UPDATE dbo.Temp SET Status = 'L' WHERE Status IS NULL;

Upvotes: 5

Related Questions