> For the complete documentation index, see [llms.txt](https://build-it-branding.gitbook.io/mssql-sql-database-connector/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://build-it-branding.gitbook.io/mssql-sql-database-connector/plugin-actions/mssql-command.md).

# MSSQL Command

We are now ready to use the plugin to SELECT/INSERT/UPDATE/DELETE/EXECUTE data from our SQL database.

The MSSQL Command is the only action available for MSSQL databases. The workflow property editor requires you to specify the following fields:

* **Query Type:** Choose from the dropdown list of options
  * SELECT, INSERT, UPDATE, DELETE, EXECUTE
* **Query:** The query text to retrieve/modify the database.&#x20;
  * e.g. "SELECT \* FROM dbo.Customers"&#x20;
* **Data Type:** The custom Data Type field definition
  * *Note: This Data Type must be a custom Data Type defined by the Bubble SQL Connector and not a Bubble Database Data Type*&#x20;

An example select statement based on the customer definition we have been using:

<figure><img src="/files/IgNq55YqnKXlFjw1THUk" alt=""><figcaption></figcaption></figure>

When you retrieve the results the action makes several properties available for use within further workflow steps. These properties are:

* **Data:** This property gives you access to the results data object.&#x20;
  * *Note: The Data Type of this property is the custom Data Type defined in the "Data Type" field specified in the SQL Command property editor.*
* **timer:** This property allows you to determine how long the query is taking to execute. This field is provided to help in debugging.
* **json:** This property contains the JSON results of the data type. This is convenient if you need to pass the data along to another API/workflow which requires JSON input.
* **meta:** If there is meta information returned by the query it will be available in this field. If the query returns no meta information then this field will be empty.
* **Completed:** This field will be "yes" when the query has completed and "no" while it is still running. This is convenient for loading pages/icons.

You can execute the SQL Command on the "Page is Loaded" event or on a button click event or however works best in your application. Then set a custom state with the results and use them in your application.

<figure><img src="/files/z0XWRVhRW3XLncuod3rH" alt=""><figcaption></figcaption></figure>

Since we have defined the custom type you can use all of the field properties as you would with data coming directly out of the Bubble default database.

<figure><img src="/files/7LORKZl8l7iRZeoRHE0y" alt=""><figcaption></figcaption></figure>
