• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Most basic SQL question and I still am making a mistake.

KAMAZON

Golden Member

UPDATE MemberDetails
SET
STREET = '45 Upper Road',
City = 'New Town',
State = 'New State',
ZipCode = '99112',
WHERE MemberID = 4;


Server: Msg 156, Level 15, State 1, Line 8
Incorrect syntax near the keyword 'WHERE'.


I have also tried it with:
WHERE MemberID = '4';
WHERE MemberID = 4


with open close parens:
UPDATE MemberDetails
SET
(
STREET = '45 Upper Road',
City = 'New Town',
State = 'New State',
ZipCode = '99112',
WHERE MemberID = 4
);



This is MS SQL 2000 running on my XP pro box. Any suggestions? Thanks.
 
You don't want a comma after the:

ZipCode = '99112'

as you're not continuing the same bit if you know what i mean...

Also - is ZipCode an integer or a string? If it's an int you don't want those quotes around it.

UPDATE MemberDetails
SET
(
STREET = '45 Upper Road',
City = 'New Town',
State = 'New State',
ZipCode = '99112'
WHERE MemberID = 4
);

or

UPDATE MemberDetails
SET
(
STREET = '45 Upper Road',
City = 'New Town',
State = 'New State',
ZipCode = 99112
WHERE MemberID = 4
);

/edit: LOL beaten to it twice
 
In case no one has mentioned it yet, you have an extra comma after the zip code.
 
Back
Top