Microsoft SQL Server
App · Databases · 20 actions
Query and change data in Microsoft SQL Server and Azure SQL: run T-SQL with safe parameters, call stored procedures, select, insert, update, upsert and delete rows without writing SQL, create and drop tables, and look up schemas, tables, columns and indexes.
Actions
| Action | What it does |
|---|---|
| Count rows | How many rows in a table match the given values. |
| Create table | Create a table from a list of columns. |
| Delete rows | Remove the rows matching the given values. |
| Drop table | Delete a table and every row in it. |
| Get server info | The server's edition and version, the connected database and the login in use. |
| Insert row | Add one row to a table and get back its new identity value, if the table has an identity column. |
| Insert rows | Add up to 1,000 rows in one go, all or nothing. |
| List columns | A table's or view's columns in order, with type, length, nullability and default. |
| List databases | The databases the login can see, with state and recovery model. |
| List indexes | A table's indexes with their key and included columns, and its primary key columns. |
| List schemas | The schemas in the connected database. |
| List stored procedures | The database's own stored procedures, optionally with each one's parameters. |
| List tables | The tables the login can see, optionally in one schema. |
| List views | The views the login can see, optionally in one schema. |
| Run query | Run a T-SQL query and return its rows. |
| Run statement | Run an INSERT, UPDATE, DELETE, MERGE or DDL statement (such as CREATE VIEW) and get the number of rows it changed. |
| Run stored procedure | Run a stored procedure with named arguments and return every result set it produces plus its return value. |
| Select rows | Read rows from a table without writing SQL: choose columns, match on values, sort and page. |
| Update rows | Change columns on the rows matching the given values. |
| Upsert row | Update the row with the same key, or insert it if there is none. |
Count rows
How many rows in a table match the given values.
Inputs
- Table
tabletextRequired - The table's name, e.g. Customers (or sales.Customers to name the schema too). Use 'List tables' to find one.
- Schema
schematext - The table's schema. Most tables are in dbo.Default:
dbo. - Match rows where
filtersobject - Column and value pairs every row must equal, e.g. {"status": "active"}. A list matches any of its values; null matches empty.
Outputs
countnumbertabletext
Example output
{
"count": 42,
"table": "dbo.Customers"
}Create table
Create a table from a list of columns. By default an existing table of that name is left alone.
Inputs
- Table
tabletextRequired - The table's name, e.g. Customers (or sales.Customers to name the schema too). Use 'List tables' to find one.
- Schema
schematext - The table's schema. Most tables are in dbo.Default:
dbo. - Columns
columnslistRequired - One entry per column, written as name then type, e.g. 'id int identity primary key', 'email nvarchar(255) not null', 'amount decimal(10,2)'. Types: bigint, int, smallint, tinyint, bit, decimal, numeric, money, smallmoney, float, real, date, time, datetime2, datetimeoffset, datetime, smalldatetime, char, varchar, nchar, nvarchar, binary, varbinary, uniqueidentifier, xml.
- Skip if it exists
if_not_existstrue/false - Leave an existing table alone instead of failing.Default:
true.
Outputs
createdtrue/falsetabletext
Example output
{
"created": true,
"table": "dbo.Customers"
}Delete rows
Remove the rows matching the given values. At least one match is required.
Inputs
- Table
tabletextRequired - The table's name, e.g. Customers (or sales.Customers to name the schema too). Use 'List tables' to find one.
- Schema
schematext - The table's schema. Most tables are in dbo.Default:
dbo. - Match rows where
filtersobjectRequired - Column and value pairs every row must equal, e.g. {"id": 42}. Required, so the whole table can never be changed by accident.
Outputs
rows_affectednumbertabletext
Example output
{
"rows_affected": 1,
"table": "dbo.Customers"
}Drop table
Delete a table and every row in it. This cannot be undone.
Inputs
- Table
tabletextRequired - The table's name, e.g. Customers (or sales.Customers to name the schema too). Use 'List tables' to find one.
- Schema
schematext - The table's schema. Most tables are in dbo.Default:
dbo. - Ignore if missing
if_existstrue/false - Succeed without doing anything if it is not there.Default:
true.
Outputs
droppedtrue/falsetabletext
Example output
{
"dropped": true,
"table": "dbo.Customers"
}Get server info
The server's edition and version, the connected database and the login in use. The quickest way to check the connection.
Inputs
None.
Outputs
collationtextdatabase_nametexteditiontextengine_editionnumberengine_edition_nametextlogin_nametextproduct_leveltextproduct_versiontextserver_nametextversion_stringtext
Example output
{
"collation": "SQL_Latin1_General_CP1_CI_AS",
"database_name": "mydatabase",
"edition": "SQL Azure",
"engine_edition": 5,
"engine_edition_name": "SQL Database",
"login_name": "sqladmin",
"product_level": "RTM",
"product_version": "12.0.2000.8",
"server_name": "myserver",
"version_string": "Microsoft SQL Azure (RTM) - 12.0.2000.8"
}Insert row
Add one row to a table and get back its new identity value, if the table has an identity column.
Inputs
- Table
tabletextRequired - The table's name, e.g. Customers (or sales.Customers to name the schema too). Use 'List tables' to find one.
- Schema
schematext - The table's schema. Most tables are in dbo.Default:
dbo. - Values
valuesobjectRequired - Column and value pairs, e.g. {"name": "Ada", "email": "ada@example.com"}. Leave out identity and default columns.
Outputs
identitynumberrows_affectednumbertabletext
Example output
{
"identity": 43,
"rows_affected": 1,
"table": "dbo.Customers"
}Insert rows
Add up to 1,000 rows in one go, all or nothing. A column missing from a row is stored as null.
Inputs
- Table
tabletextRequired - The table's name, e.g. Customers (or sales.Customers to name the schema too). Use 'List tables' to find one.
- Schema
schematext - The table's schema. Most tables are in dbo.Default:
dbo. - Rows
rowslistRequired - A list of rows, each a column and value object, e.g. [{"name": "Ada"}, {"name": "Grace"}].
Outputs
rows_affectednumbertabletext
Example output
{
"rows_affected": 2,
"table": "dbo.Customers"
}List columns
A table's or view's columns in order, with type, length, nullability and default.
Inputs
- Table
tabletextRequired - The table's name, e.g. Customers (or sales.Customers to name the schema too). Use 'List tables' to find one.
- Schema
schematext - The table's schema. Most tables are in dbo.Default:
dbo.
Outputs
columnslistcountnumbertabletext
Example output
{
"columns": [
{
"character_maximum_length": null,
"collation_name": null,
"column_default": null,
"column_name": "id",
"data_type": "int",
"datetime_precision": null,
"is_nullable": false,
"numeric_precision": 10,
"numeric_scale": 0,
"ordinal_position": 1
}
],
"count": 1,
"table": "dbo.Customers"
}List databases
The databases the login can see, with state and recovery model. On Azure SQL Database this is the connected database and master only.
Inputs
None.
Outputs
countnumberdatabaseslist
Example output
{
"count": 1,
"databases": [
{
"collation_name": "SQL_Latin1_General_CP1_CI_AS",
"compatibility_level": 170,
"create_date": "2026-09-01T10:00:00",
"database_id": 5,
"is_read_only": false,
"name": "mydatabase",
"recovery_model_desc": "FULL",
"state_desc": "ONLINE",
"user_access_desc": "MULTI_USER"
}
]
}List indexes
A table's indexes with their key and included columns, and its primary key columns.
Inputs
- Table
tabletextRequired - The table's name, e.g. Customers (or sales.Customers to name the schema too). Use 'List tables' to find one.
- Schema
schematext - The table's schema. Most tables are in dbo.Default:
dbo.
Outputs
countnumberindexeslistprimary_key_columnslisttabletext
Example output
{
"count": 1,
"indexes": [
{
"filter_definition": null,
"has_filter": false,
"included_columns": [],
"index_id": 1,
"is_disabled": false,
"is_primary_key": true,
"is_unique": true,
"is_unique_constraint": false,
"key_columns": [
{
"column": "id",
"descending": false
}
],
"name": "PK_Customers",
"type_desc": "CLUSTERED"
}
],
"primary_key_columns": [
"id"
],
"table": "dbo.Customers"
}List schemas
The schemas in the connected database.
Inputs
- Include system schemas
include_systemtrue/false - Also list sys, INFORMATION_SCHEMA and the db_ roles.Default:
false.
Outputs
countnumberschemaslist
Example output
{
"count": 1,
"schemas": [
{
"catalog_name": "mydatabase",
"schema_name": "dbo",
"schema_owner": "dbo"
}
]
}List stored procedures
The database's own stored procedures, optionally with each one's parameters.
Inputs
- Schema
schematext - Only this schema. Leave empty for every schema.
- Include parameters
include_parameterstrue/false - Also list each procedure's parameters and types.Default:
false.
Outputs
countnumberprocedureslist
Example output
{
"count": 1,
"procedures": [
{
"create_date": "2026-09-01T10:00:00",
"modify_date": "2026-09-01T10:00:00",
"name": "usp_GetCustomer",
"object_id": 581577110,
"schema_name": "dbo",
"type": "P",
"type_desc": "SQL_STORED_PROCEDURE"
}
]
}List tables
The tables the login can see, optionally in one schema.
Inputs
- Schema
schematext - Only this schema. Leave empty for every schema.
Outputs
countnumbertableslist
Example output
{
"count": 1,
"tables": [
{
"table_catalog": "mydatabase",
"table_name": "Customers",
"table_schema": "dbo",
"table_type": "BASE TABLE"
}
]
}List views
The views the login can see, optionally in one schema.
Inputs
- Schema
schematext - Only this schema. Leave empty for every schema.
Outputs
countnumberviewslist
Example output
{
"count": 1,
"views": [
{
"table_catalog": "mydatabase",
"table_name": "ActiveCustomers",
"table_schema": "dbo",
"table_type": "VIEW"
}
]
}Run query
Run a T-SQL query and return its rows. Use %(name)s placeholders with 'Parameters' for any value that comes from data. The login's permissions decide what it can touch.
Inputs
- SQL query
querytextRequired - The T-SQL to run, e.g. SELECT * FROM dbo.Customers WHERE status = %(status)s.
- Parameters
parametersobject - Values for each %(name)s in the SQL, e.g. {"status": "active"} for WHERE status = %(status)s. Passing values here, not pasting them into the SQL, keeps a quote in the data from changing the statement.
- Maximum rows
max_rowsnumber - Return at most this many rows.From 1 to 10000. Default:
1000.
Outputs
columnslist- Column names, in order
row_countnumber- Rows returned
rowslist- The rows, each keyed by column
rows_affectednumber- Rows changed, when the batch changed data
truncatedtrue/false- True when more rows existed than the limit allowed
Example output
{
"columns": [
"id",
"name",
"email"
],
"row_count": 1,
"rows": [
{
"email": "ada@example.com",
"id": 1,
"name": "Ada Lovelace"
}
],
"rows_affected": -1,
"truncated": false
}Run statement
Run an INSERT, UPDATE, DELETE, MERGE or DDL statement (such as CREATE VIEW) and get the number of rows it changed. Use %(name)s placeholders with 'Parameters' for values.
Inputs
- SQL statement
statementtextRequired - The T-SQL to run.
- Parameters
parametersobject - Values for each %(name)s in the SQL, e.g. {"status": "active"} for WHERE status = %(status)s. Passing values here, not pasting them into the SQL, keeps a quote in the data from changing the statement.
Outputs
rows_affectednumber
Example output
{
"rows_affected": 1
}Run stored procedure
Run a stored procedure with named arguments and return every result set it produces plus its return value.
Inputs
- Procedure
proceduretextRequired - The procedure's name, e.g. usp_GetCustomer. Use 'List stored procedures' to find one.
- Schema
schematext - The table's schema. Most tables are in dbo.Default:
dbo. - Arguments
parametersobject - Argument names and values, e.g. {"@customer_id": 42}. The @ is optional.
- Maximum rows
max_rowsnumber - Return at most this many rows.From 1 to 10000. Default:
1000.
Outputs
proceduretextresult_set_countnumberresult_setslistreturn_valuenumber
Example output
{
"procedure": "dbo.usp_GetCustomer",
"result_set_count": 1,
"result_sets": [
{
"columns": [
"id",
"name",
"email"
],
"row_count": 1,
"rows": [
{
"email": "ada@example.com",
"id": 1,
"name": "Ada Lovelace"
}
],
"truncated": false
}
],
"return_value": 0
}Select rows
Read rows from a table without writing SQL: choose columns, match on values, sort and page. A limit always applies.
Inputs
- Table
tabletextRequired - The table's name, e.g. Customers (or sales.Customers to name the schema too). Use 'List tables' to find one.
- Schema
schematext - The table's schema. Most tables are in dbo.Default:
dbo. - Columns
columnslist - Columns to return. Leave empty for all.
- Match rows where
filtersobject - Column and value pairs every row must equal, e.g. {"status": "active"}. A list matches any of its values; null matches empty.
- Sort by column
order_bytext - Column to sort on. Leave empty for no order.
- Sort direction
sort_directiontext - Which way to sort, when a sort column is given.One of:
ASC(Ascending),DESC(Descending). Default:ASC. - Maximum rows
limitnumber - Return at most this many rows.From 1 to 10000. Default:
100. - Skip rows
offsetnumber - Skip this many rows first, for paging. Set a sort column too, or the pages may overlap.From 0 to 100000000. Default:
0.
Outputs
columnslist- Column names, in order
row_countnumber- Rows returned
rowslist- The rows, each keyed by column
tabletext- schema.table
truncatedtrue/false- True when more rows existed than the limit allowed
Example output
{
"columns": [
"id",
"name",
"email"
],
"row_count": 1,
"rows": [
{
"email": "ada@example.com",
"id": 1,
"name": "Ada Lovelace"
}
],
"table": "dbo.Customers",
"truncated": false
}Update rows
Change columns on the rows matching the given values. At least one match is required.
Inputs
- Table
tabletextRequired - The table's name, e.g. Customers (or sales.Customers to name the schema too). Use 'List tables' to find one.
- Schema
schematext - The table's schema. Most tables are in dbo.Default:
dbo. - New values
valuesobjectRequired - Column and value pairs to set, e.g. {"status": "inactive"}.
- Match rows where
filtersobjectRequired - Column and value pairs every row must equal, e.g. {"id": 42}. Required, so the whole table can never be changed by accident.
Outputs
rows_affectednumbertabletext
Example output
{
"rows_affected": 1,
"table": "dbo.Customers"
}Upsert row
Update the row with the same key, or insert it if there is none. The key defaults to the table's primary key.
Inputs
- Table
tabletextRequired - The table's name, e.g. Customers (or sales.Customers to name the schema too). Use 'List tables' to find one.
- Schema
schematext - The table's schema. Most tables are in dbo.Default:
dbo. - Values
valuesobjectRequired - Column and value pairs for the row, including its key, e.g. {"email": "ada@example.com", "name": "Ada"}.
- Match on columns
key_columnslist - The columns that identify the row. Leave empty to use the primary key.
Outputs
actiontextkey_columnslistrows_affectednumbertabletext
Example output
{
"action": "UPDATE",
"key_columns": [
"id"
],
"rows_affected": 1,
"table": "dbo.Customers"
}