我正在尝试在数据库中添加一行(如果它不存在)或者如果它存在则更新该行。我在这个SQL语句中哪里出错?
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')
答案 0 :(得分:1)
删除SET
周围的括号。它应该这样写:
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',
....