[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 249
  • Last Modified:

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
0
cseink
Asked:
cseink
1 Solution
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
if flag = true
  sql = " update tbl_main set myvalue = myvalue + 1 "
  execute(sql)
end if
0
 
cseinkAuthor Commented:
Perfect. Thanks
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now