Nolio KB: How do I use select and update  in a single action while running

Document created by MaryGreening on Jul 8, 2014
Version 1Show Document
  • View in full screen mode

Nolio Official KB: How do I use select and update  in a single action while running a SQL query in Nolio?

In order to use both an Select query and update in a Nolio SQL query Script, you need to have as your first line SET NOCOUNT ON . This will allow you to process the update and the receive the outputs from the select query. Otherwise the script may update the Database but return an empty resultset.
Example:
set nocount on;
begin tran;
Update S
Set Last = 1
From [dbo].[nolio] S
Where First in  (Select Top 1 First
From dbo.nolio NL
WHERE NL.ID = 0);
select * from [dbo].[nolio]
commit;

 

Can I use the same for Oracle and MySQL query?

 

This document was generated from the following discussion: Nolio KB: How do I use select and update  in a single action while running

Attachments

    Outcomes