• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 210
  • Last Modified:

Simple update statement won't work on a particular column

I have an update query that I'm trying to implement. It just won't work. (It's not exactly the query below but I'm just trying that in order to try and get a simple query to work)

So, I'm trying to update the column Password below. Doesn't work. However, if I try and update the column Team (simply substitute Password for Team) and it works fine. So, everything is fine except that the column Password just won't update (the error message is that there is an error in the syntax of the sql query... which can't be since the column Team works just fine)

So, I've looked at the columns and I can't see any reason why this would be happening. Just to be on the safe side I filled the password with the same info as in the team column and set all the properties of the password column to the same as the team column... still doesn't work?

Any ideas?
MySQL = "UPDATE `User Information`"
MySQL = MySQL + " SET Password = NULL"

Open in new window

1 Solution
Use [User Information] instead of `User Information`
Can you try this

MySQL = "UPDATE `User Information`"
MySQL = MySQL + " SET [Password] = NULL"

AidenAAuthor Commented:
Hi thanks,

John, your version worked... why is that? I know I've done other queries where I did not need the brackets... (the one with the column Team being a recent example!). Why with this particular column?

Kevin CrossChief Technology OfficerCommented:
Password is a reserved word, so you have to tell SQL it is column in this case.
Yep!!!. mwvisa1 is correct. All the reserved words should be included with [] in sql queries.

Featured Post

Get quick recovery of individual SharePoint items

Free tool – Veeam Explorer for Microsoft SharePoint, enables fast, easy restores of SharePoint sites, documents, libraries and lists — all with no agents to manage and no additional licenses to buy.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now