Pass Arguments to Query

I am trying to pass the arguments to query but i have some problem in that.
can someone tell how to pass the arguments to query

Share the query and tell us the activity which you are using,
If you want to run Store Proc then you must have to change the type of execute non query activity from text to store proc.
Pass the parameter as argument, the argument name must be same as defined in SP with @ symbol.

we have to pass Table Types as paramter in uipath

hi ezharul,

i have mentioned the steps kindly follow this steps.
step-1


create Table type where you want to insert
step-2


Create Procedure [dbo].[Usp_BulkInsertUserProcessDetails]
(
@tblProcessOwnerDetails ProcessOwnerDetailsType READONLY
)
AS
BEGIN
SET NOCOUNT ON;
IF EXISTS(SELECT COUNT(*) FROM @tblProcessOwnerDetails)
BEGIN
INSERT INTO tbl_ProcessOwnerDetails_backup
SELECT POName,
ProcessId,
UserId,
EncryptByPassPhrase(ā€˜EncPwdā€™,CONVERT(Varbinary(50),Password)),
UpdatedBy,
UpdatedOn,
Status,ISNULL(UserType,ā€˜ā€™) FROM @tblProcessOwnerDetails
END
END

step-3


_____

step-4


In parameter we have mentioned 4 field:

In name: give tabletype name i.e.tblProcessOwnerDetails(Donā€™t write @)

In Direction:In (input parameter)

In Type:System.Data.DataTable

In Value:Pass object of Datatable(dt)

You can try it if any queries ask me.

Hi JothyPrasanth,

You can pass paramter in this way

You can use Execute Query or Execute Non Query in property just select the command type what you want to use either stored procedure/Text/Table then in paramter field you can pass paramter in this way

In name: give tabletype name i.e.tblProcessOwnerDetails(Donā€™t write @)

In Direction:In (input parameter)

In Type:System.Data.DataTable

In Value:Pass object of Datatable(dt)

Just try it if any queries then i can upload the xaml file

Thnak u @sampad

Please upload the xaml file that will help to solve my problem

Hi JothyPrasanth,

Can you give me your mailid then i can send the xaml file, i am unable to upload the xaml file it is giving me some error new user canā€™t upload can you give your mail id then i will send the details.

1 Like

Hi Ezharul,

You can pass the parameter like this i.e

in sp parameter is @ symbol you can only pass symbol with out special character i.e @sampad

Hi @sampad@Ezharul@jothyprasanth.m,

i need to pass filepath as arguement in sql query.Below is the sql query.My file path is in variable below
variable=ā€˜C:\Users\Desktop\attachments\sss.txtā€™

This is the query with variable
ā€œINSERT Into tbl_Errors(Attachments)
Select * From OPENROWSET(BULK Nā€™variableā€™, SINGLE_BLOB) As Attachmentsā€

When iā€™m passing the path ,We are able to execute without errors.
ā€œINSERT Into tbl_Errors(Attachments)
Select * From OPENROWSET(BULK Nā€™C:\Users\Desktop\attachments\sss.txtā€™, SINGLE_BLOB) As Attachmentsā€ .

Can you please help?
Thanks in advance

Hi,

Iā€™m also facing same issue to pass the data table to user-defined table parameter.Can you please share xaml file.