Reputation: 417
I have a table with 3 columns: username, password and ID.Every password and username have a specific ID. Table name is "Account" for example.
I want to update a password with a specific ID. I have tried:
UPDATE Account SET password = "newPassword"
where id = 1
However, it does not work. It will complain that "newPassword" is not a valid column name. I try my queries in SQL management studio.
Upvotes: 1
Views: 3081
Reputation: 521249
Use single quotes for string literals in MS SQL Server:
UPDATE Account
SET password = 'newPassword'
WHERE id = 1;
Double quotes in SQL are generally reserved for database objects, such as table and column names (sometimes called identifiers). Your current update is attempting to assign the password
column to a column named newPassword
. This column doesn't exist, hence you are getting an error.
Upvotes: 7