SQL select and update on one sql statement

Can you have a select and update statemnt execute in one sql statement. I have a asp script and instead of creating a recordset to get the value then add 1 to it I'd like to get the value of a field(int) and update it in one sql statement if a flag = true.

if flag = true
e.g sql= select myvalue from tbl_main. add 1 to myvalue.
execute(sql)
end if

thanks
cseinkAsked:
Who is Participating?
 
Guy Hengel [angelIII / a3]Connect With a Mentor Billing EngineerCommented:
if flag = true
  sql = " update tbl_main set myvalue = myvalue + 1 "
  execute(sql)
end if
0
 
cseinkAuthor Commented:
Perfect. Thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.