Reputation: 1
I'm trying to add a row into a database if it does not exist or update the row if it does. Where am I going wrong in this SQL statement?
UPDATE Classes
SET (Duration='44',
INModule='Actions',
EditionsFOR='Vocus VPR - Basic Edition//Vocus PR - Enterprise Edition//',
Objectives='objective 1//objective 2//objective 3//',
PreReq='prerequisite
1//prerequisite 2//prerequisite 3//',
Points='training point 1//training point 2//training point 3//',
ContentLink='www.aol.com',
OtherInfo='this is the internal info',
Summary='this is a brief summary of the class')
WHERE Title='this is the class title'
IF @@ROWCOUNT=0
INSERT INTO Classes (Title, Duration, INModule, EditionsFOR, Objectives, PreReq,
Points, ContentLink, OtherInfo, Summary)
VALUES ('this is the class title','44','Actions',
'Vocus VPR - Basic Edition//Vocus PR - Enterprise Edition//',
'objective 1//objective 2//objective 3//',
'prerequisite 1//prerequisite 2//prerequisite 3//',
'training point 1//training point 2//training point 3//',
'www.aol.com','this is the internal info',
'this is a brief summary of the class')
Upvotes: 0
Views: 99
Reputation: 79979
Remove the parentheses around SET
. It should be written this way:
UPDATE Classes
SET Duration = '44',
INModule = 'Actions',
EditionsFOR = 'Vocus VPR - Basic Edition//Vocus PR - Enterprise Edition//',
Objectives = 'objective 1//objective 2//objective 3//',
PreReq = 'prerequisite 1//prerequisite 2//prerequisite 3//',
Points = 'training point 1//training point 2//training point 3//',
ContentLink = 'www.aol.com',
....
Upvotes: 1