Get the data from DB

Hello

What is the correct way to query and retrieve data from a SQL Server database using Microsoft SQL Server Management Studio?

Hey,
You can use run query activity

Hi @Mihai_Lazer

Install package

UiPath.Database.Activities

Use Connect activity

  • ProviderName:
System.Data.SqlClient
  • ConnectionString:
Server=SERVERNAME;
Database=DBNAME;
Trusted_Connection=True;

(or SQL auth if needed)

Use Execute Query

  • SQL:
SELECT * FROM YourTable
  • Output → DataTable variable

Use the DataTable

  • For Each Row in Data table
  • Write Range (Excel)
  • Filter / process rows

Regards
Gokul

1 Like

hi @Mihai_Lazer

Quick SQL Server Setup in UiPath:

  1. Install “UiPath.Database.Activities” package
  2. Add “Connect” activity → Configure Connection → Microsoft SQL Server → Server/Database/Auth → Test & Save (output: dbConnection)
  3. Add “Execute Query” → Connection: dbConnection → SQL: SELECT * FROM YourTable → DataTable: newDT
  4. Use For Each Row or Write Range on newDT
  5. Always add “Disconnect” in Finally block

Connection string example: Server=YourServer;Database=YourDB;Integrated Security=True

you can refer to this video for more detail:

1 Like

Could provide the xaml file @Gokul001

Hi @Mihai_Lazer

DbConnectionstring = Data Source=IPAddress;Initial Catalog=DataBaseNmae;Integrated Security=True;Encrypt=False

kindly look into SS

Regards,
Gokul

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.