开发者

error with update command

 update EMP 
    set fn = @FN
    set ln = @LN
    set DOB = @DOB
    where id = @ID

when i execute the above command. I am gett开发者_C百科ing the follwing error.

Incorrect syntax near '='.

can we update more then one field with single uadate command.


You forgot to delimit the fields & you only state SET once;

 update EMP 
    set fn = @FN,
        ln = @LN,
        DOB = @DOB
 where id = @ID


It is possible to UPDATE multiple columns at the same time. The syntax in this case would look like the following:

UPDATE "table_name"
SET column_1 = [value1], column_2 = [value2]
WHERE {condition}

Ref: http://www.1keydata.com/sql/sqlupdate.html

Hope this helps.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜