Apps
MS SQL
24 min
learn how to connect engini to ms sql using engini’s ms sql activities, you can create, get and update records to manage and define databases getting started with ms sql prerequisites a ms sql account add a connection to ms sql in engini the ms sql connector uses basic authentication to authenticate with sql server enter your engini account at https //app engini io navigate to connections page by clicking on the connections on the left sidebar or by clicking https //app engini io/connections click on the add connection option located at the topbar choose ms sql option from the available applications enter the following details in the “add connection” form and press save connection name enter a unique and descriptive name for this connection this name will help you identify and manage the connection in your engini account “ms sql” by default server address specify the address or hostname of your ms sql server this is the location where your database is hosted database name provide the name of the specific database within the ms sql server that you want to connect to username enter the username associated with your ms sql database this username should have the necessary permissions to access and interact with the database password enter the corresponding password for the provided username make sure the password is accurate to establish a secure connection connection type choose the appropriate connection type based on your setup cloud if you are connecting to a database hosted in a cloud environment, select “cloud” opa if your database is on premises and you are using an on premises agent (opa) for the connection, select “opa” in this case, an additional field will appear on prem agent choose the specific on premises agent that you want to use for this connection if you have multiple agents configured after clicking “save”, a window will prompt you to select database objects from available tables/views/stored procedures you can select the databases you want to use by marking the corresponding checkboxes of the tables/view/stored procedures you intend to utilize subsequently, you can perform various activities within your workflow and access the data stored within these selected tables/views/stored procedures actions create record table click on the empty field and the tooltip will pop up showing all the tables you can use all available tables will be accessible and you can select the specific table for the new record you create add field by clicking the “add field” button, you can choose how to fill in the various fields in the record you are creating you can add one field or more to the activity definitions choose from the drop down the field you want to fill click on the empty field to the right of the drop down to be shown the tooltip with all the options you can use to fill the field you can populate the field in one of the following options static value – number / string when using strings, you need to surround them with single quotes (‘) property value from a previous activity (using the tooltip that opens when clicking on the field) expression – using functions and/or previous activity properties and/or static values (using the tooltip that opens when clicking on the field) repeat steps 1 3 for all the fields you want to populate get records get records from a specified sql table/view table/view click on the empty field and the tooltip will pop up showing all the tables/views you can use all available tables/views will be accessible and you can select the specific tables/views of the records you want to get top you can set the number of rows you want to retrieve from the table or view this parameter limits the result set to the specified number of records, with the default being 100 if you set top n = 1, a single record will be returned instead of an array if no record is found, the action will fail, allowing you to implement an if condition within the workflow this can be useful for processes where the existence of a record determines the next steps in the workflow offset if you want to skip a certain number of rows before retrieving data, you can set the offset value the default is 0, meaning no rows are skipped add filter by clicking the “add filter” button, you can specify which records will be returned from the get results you can add one filter or more to the activity definitions choose from the drop down the field you want to filter by select the condition you want the record to meet for the selected field click on the field to show the tooltip with all the options you can choose you can populate the field in one of the following options static value – number / string when using strings, you need to surround them with single quotes (‘) property value from a previous activity (using the tooltip that opens when clicking on the field) expression – using functions and/or previous activity properties and/or static values (using the tooltip that opens when clicking on the field) add sorting you can specify sorting criteria for the retrieved data sorting helps you order the records based on specific columns, such as ascending or descending order update record table click on the empty field and the tooltip will pop up showing all the tables you can use all available tables will be accessible and you can select the specific table of the record you want to update add field by clicking the “add field” button, you can choose how to fill in the various fields in the record you are creating you can add one field or more to the activity definitions choose from the drop down the field you want to fill click on the empty field to the right of the drop down to be shown the tooltip with all the options you can use to fill the field you can populate the field in one of the following options static value – number / string when using strings, you need to surround them with single quotes (‘) property value from a previous activity (using the tooltip that opens when clicking on the field) expression – using functions and/or previous activity properties and/or static values (using the tooltip that opens when clicking on the field) repeat steps 1 3 for all the fields you want to populate update records table click on the empty field and the tooltip will pop up showing all the tables you can use all available tables will be accessible and you can select the specific table of the records you want to update add fields by clicking the “add field” button, you can choose how to fill in the various fields in the record you are creating you can add one field or more to the activity definitions choose from the drop down the field you want to fill click on the empty field to the right of the drop down to be shown the tooltip with all the options you can use to fill the field you can populate the field in one of the following options static value – number / string when using strings, you need to surround them with single quotes (‘) property value from a previous activity (using the tooltip that opens when clicking on the field) expression – using functions and/or previous activity properties and/or static values (using the tooltip that opens when clicking on the field) add filter by clicking the “add filter” button, you can specify which records will be returned from the get results you can add one filter or more to the activity definitions choose from the drop down the field you want to filter by select the condition you want the record to meet for the selected field click on the field to show the tooltip with all the options you can choose you can populate the field in one of the following options static value – number / string when using strings, you need to surround them with single quotes (‘) property value from a previous activity (using the tooltip that opens when clicking on the field) expression – using functions and/or previous activity properties and/or static values (using the tooltip that opens when clicking on the field) delete records table click on the empty field and the tooltip will pop up showing all the tables you can use all available tables will be accessible and you can select the specific table of the record(s) you want to delete add filters by clicking the “add filter” button, you can specify which records will be returned from the get results you can add one filter or more to the activity definitions choose from the drop down the field you want to filter by select the condition you want the record to meet for the selected field click on the field to show the tooltip with all the options you can choose you can populate the field in one of the following options property value from a previous activity (using the tooltip that opens when clicking on the field) expression – using functions and/or previous activity properties and/or static values (using the tooltip that opens when clicking on the field) static value – number / string when using strings, you need to surround them with single quotes (‘) create batch of records this activity iterates over a selected data list and for each record in the data list create records for a designated sql table corresponding to the specified data list data list click on the empty field next to the data list label and the tooltip will popup showing only previous activities than contains data lists from which you can choose choose a data list to iterate on table click on the empty field and the tooltip will pop up showing all the tables you can use all available tables will be accessible and you can select the specific table for the new records you create add field by clicking the “add field” button, you can choose how to fill in the various fields in the record you are creating you can add one field or more to the activity definitions choose from the drop down the field you want to fill click on the empty field to the right of the drop down to be shown the tooltip with all the options you can use to fill the field you can populate the field in one of the following options static value – number / string when using strings, you need to surround them with single quotes (‘) property value from a previous activity (using the tooltip that opens when clicking on the field) expression – using functions and/or previous activity properties and/or static values (using the tooltip that opens when clicking on the field) repeat steps 1 3 for all the fields you want to populate get records batch this activity iterates over a selected data list and for each record in the data list retrieves records from a designated sql table corresponding to the specified data list data list click on the empty field next to the data list label and the tooltip will popup showing only previous activities than contains data lists from which you can choose choose a data list to iterate on table click on the empty field and the tooltip will pop up showing all the tables you can use all available tables will be accessible and you can select the specific table of the record(s) you want to get top you can set the number of rows you want to retrieve from the table or view this parameter limits the result set to the specified number of records, with the default being 100 if you set top n = 1, a single record will be returned instead of an array if no record is found, the action will fail, allowing you to implement an if condition within the workflow this can be useful for processes where the existence of a record determines the next steps in the workflow add filters by clicking the “add filter” button, you can specify which records will be returned from the get results you can add one filter or more to the activity definitions choose from the drop down the field you want to filter by select the condition you want the record to meet for the selected field click on the field to show the tooltip with all the options you can choose you can populate the field in one of the following options static value – number / string when using strings, you need to surround them with single quotes (‘) property value from a previous activity (using the tooltip that opens when clicking on the field) expression – using functions and/or previous activity properties and/or static values (using the tooltip that opens when clicking on the field) add sorting you can specify sorting criteria for the retrieved data sorting helps you order the records based on specific columns, such as ascending or descending order update batch of records this activity iterates over a selected data list and for each record in the data list updates records from a designated sql table corresponding to the specified data list data list click on the empty field next to the data list label and the tooltip will popup showing only previous activities than contains data lists from which you can choose choose a data list to iterate on table click on the empty field and the tooltip will pop up showing all the tables you can use all available tables will be accessible and you can select the specific table of the record(s) you want to update add filters by clicking the “add filter” button, you can specify which records will be returned from the get results you can add one filter or more to the activity definitions choose from the drop down the field you want to filter by select the condition you want the record to meet for the selected field click on the field to show the tooltip with all the options you can choose you can populate the field in one of the following options static value – number / string when using strings, you need to surround them with single quotes (‘) property value from a previous activity (using the tooltip that opens when clicking on the field) expression – using functions and/or previous activity properties and/or static values (using the tooltip that opens when clicking on the field) add field by clicking the “add field” button, you can choose how to fill in the various fields in the record you are creating you can add one field or more to the activity definitions choose from the drop down the field you want to fill click on the empty field to the right of the drop down to be shown the tooltip with all the options you can use to fill the field you can populate the field in one of the following options static value – number / string when using strings, you need to surround them with single quotes (‘) property value from a previous activity (using the tooltip that opens when clicking on the field) expression – using functions and/or previous activity properties and/or static values (using the tooltip that opens when clicking on the field) repeat steps 1 3 for all the fields you want to populate execute customized sql the “execute customized sql” activity is an activity that allows you to interact with a ms sql system by running custom sql queries or commands within your workflow in the sql text field, you can write and enter your own sql queries, which are structured commands that define what you want to do with the data in the ms sql system these queries can include operations like data retrieval, modification, or database management execute procedure the “execute procedure” activity is an activity that allows you to interact with a ms sql system by running stored procedures within your workflow procedure name you need to specify the name of a stored procedure that exists within your ms sql database a stored procedure is a pre defined, reusable set of sql commands that are stored in the database and can be executed on demand add field by clicking the “add field” button, you can add fields or parameters to provide input to the procedure you you can add one field or more to the activity definitions choose from the drop down the field you want to fill click on the empty field to the right of the drop down to be shown the tooltip with all the options you can use to fill the field you can populate the field in one of the following options static value – number / string when using strings, you need to surround them with single quotes (‘) property value from a previous activity (using the tooltip that opens when clicking on the field) expression – using functions and/or previous activity properties and/or static values (using the tooltip that opens when clicking on the field) keep connection alive until complete – keeps the database connection open until the stored procedure finishes running, ensuring the execution completes successfully and the full result is returned, especially for long running procedures