Pass Arguments to Query


#1

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


#2

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.


#3

we have to pass Table Types as paramter in uipath


#4

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.


#5

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


#6

Thnak u @sampad


#7

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


#8

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.


#9

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


#10

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


#11

Hi,

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