Execute multiple line query in UiPath

Dear all,

Is it possible to Execute multiple line query in UiPath.

declare @SQL varchar(1000),@abc varchar(30),@xyz VARCHAR(30)
select @xyz=(select col1 from tbl1 WHERE col2=(‘value’))
SELECT @abc=‘test’
SELECT Column8 FROM ‘+@xyz+’.SKU WHERE Column=’’’+@abc+’’’’)
EXEC(@SQL)

Waiting for the response.

Thanks in advance.

Hi @MariaJosephina

Could you try putting in as one string, replacing line breaks to spaces? Just an idea, it might get processed correctly with that.

1 Like

Hi @loginerror,

It doesn’t work :worried:

Could you post a screenshot of the entire query and the syntax error it generates?

Hi @loginerror ,

Query: “DECLARE @A INT = 1 SET @A = (SELECT TOP A FROM [Sheet1$]); UPDATE [Sheet2$] SET B = @A WHERE B = 3; GO”

Exception: “Execute Query: ERROR [42000] [Microsoft][ODBC Excel Driver] Invalid SQL statement; expected ‘DELETE’, ‘INSERT’, ‘PROCEDURE’, ‘SELECT’, or ‘UPDATE’.”

Excel_Connect_1

Please assist me in this.

Thanks in advance,
Manoj Vijayakumar

did u get solution for this manoj?