Question

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

Était-ce utile?

La solution

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

Autres conseils

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

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top