简体   繁体   中英

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'

在此处输入图片说明

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM