Skip to main content

 

if ((select counttColname] from Tablename$$] where Clasificacion] = 'A') > 1)

begin

Update Tablename$$] Set Status] = 'Test' where Colname] IN ('X','Y') and Clasificacion] ='A'

end

 

Can we use If and update together in AA360?

I want to identify if a set of values exists or not in excel table and then need to update status.

I have tried using the above code but it is throwing SQL syntax error.

How to achieve this or Is there any other approach ?

There is no apparent syntax error in this code. However, the expression count[Colname] should have parentheses around the count function, so the square brackets should be removed. The correct code should be:

if ((select count(Colname) from [Tablename$$] where [Clasificacion] = 'A') > 1)
begin
  Update Tablename$$] Set Status] = 'Test' where Colname] IN ('X','Y') and Clasificacion] ='A'
end
 


It is still throwing syntax error


if ((select count([Colname]) from [Tablename$$] where [Clasificacion] = 'A') > 1)
begin
    Update eTablename$$] Set tStatus] = 'Test' where eColname] IN ('X','Y') and dClasificacion] ='A'
end

Try this  -> count(oColname])


Have you considered using the IF logic in AA surrounds by 2 DB calls -

the 1st DB query would return the count of records found 

use AA  IF logic to test the result to be > 0

the 2nd DB statement would be the update.

 


Reply