How to include query parameters

I need to run a query that contains the @NomeMaquina and @IdProcesso parameters, but when trying to include in the error uipath, could anyone help me?
below is the query I’m using

ALTER PROC [dbo].[ProObterProxCasoProcessamento]
@IdProcesso INT,
@nomeMaquina varchar(50)
AS
BEGIN
DECLARE @IdCaso INT

--REALIZA A CONSULTA PELO PRÓXIMO CASO DISPONÍVEL
SELECT TOP 1
	@IdCaso = spc.IdCaso
	
FROM
	statusprocessoscaso spc
WHERE
	(
		spc.IdStatus = 1
		OR
		(
			spc.IdStatus = 2
			AND
			spc.DataAlteracao < DATEADD(MINUTE, -20, GETDATE())
		)
		OR
		(
			spc.IdStatus = 6
			AND
			spc.DataAlteracao < DATEADD(MINUTE, -20, GETDATE())
		)
	)
	AND 
	spc.IdProcesso=@IdProcesso

You can use the UiPath.Database.Activities package and the Execute Query within that.

image

You should pass parameters to the SQL query using the Parameters property

If you are following these steps and still receiving the error message, then the issue lies in your SQL syntax.

1 Like

Hi,
1/ Parameter types should match
2/ “Value” in Parameters dialog should contain values to pass to SQL query

Cheers