Jeremy McDevitt
Jeremy McDevitt

Reputation: 115

Updating value in a column SQL Server

This should be a really easy question, but I wanted to make sure it was done right where I'm not a SQL guy. We need to turn all of the patients with a security level of 1 to 2. All patients who are not at 1 are currently at 2. Thanks and sorry for asking such a simple question. SQL Server 2005.

select 

patient_id,
security_level

from patient
where security_level = '1'

enter image description here

Upvotes: 0

Views: 92

Answers (2)

MrSimpleMind
MrSimpleMind

Reputation: 8587

SQLFIDDLE

update patient set security_level = '2' 
where security_level = '1';

Above will update the entire patient table, and set the security level to 2 (where it initially was 1).

Upvotes: 3

null
null

Reputation: 3517

A simple update should work. Something like:

UPDATE patient
SET sercurity_level='2'
WHERE security_level='1';

Edit: changed correct table name and added quotes

Upvotes: 1

Related Questions