Here are my columns in my table SystemSpecCategories
ID (int)
Group ID (int)
Description (varchar)
My GroupID has values from 1-9. I would like to run a query that changes all GroupID values that are 8, and change them to 9. I am very new to SQL and I have tried :
UPDATE SystemSpecCategories
SET GroupID = 9
WHERE GroupID = 8
This through the error “8” is not a valid column name
I think I may be way off with that query but Ive tried another with REPLACE
SELECT REPLACE(Group_ID, "8", "9")
FROM SystemSpecCategories
I thought I was straight on with that one but it through an error saying incorrect syntax. Could anyone help me out? Id greatly appreciate it.
Your first try is correct.
The problem might be that your column is called
Group ID(with a space).If that is case, try: