Discoverable Procedures

Discoverable procedures in the MSSQL (BDK) Book.

Table Discovery

You must first discover a table to generate CRUD automation procedures for it:

discover "table/TableName" from mssql
  1. List: Retrieve multiple rows with optional filtering

  2. Create: Insert a single row

  3. Bulk Insert: Insert multiple rows from a table/array

  4. Get: Retrieve a single row by primary key

  5. Update: Update a single row by primary key

  6. Bulk Update: Update multiple rows from a table/array

  7. Delete: Delete a single row by primary key

How Table Names are Processed

When you discover a table, the book "transforms" the table name to generate user-friendly procedures.

1. Sanitization

Table names are converted to PascalCase. For example:

  • user_propertiesUserProperties

  • dbo.sp_GetUsersDboSpGetUsers

  • table_nameTableName

  • hasShipHasShip

2. Singularization

For certain operations, the system creates singular forms of table names:

  • UsersUser

  • UserPropertiesUserProperty

  • CarsCar

This means when you discover table/user_properties, the generated procedures will reference it as "UserProperties" table, and individual items will be referred to as "UserProperty".

Basic CRUD Operations

1. Retrieve Items (List)

Get all items from a table:

Get items with filtering:

Get items with limit:

2. Create Single Item

First, create a JSON object with the data:

3. Bulk Insert

Insert multiple rows from an external data source (like Excel):

Note: content should be a table structure with multiple rows.

4. Get Single Item by Primary Key

5. Update Single Item

6. Bulk Update

Update multiple rows from an external data source:

Note: content should include the primary key columns for matching existing rows and should be a table structure.

7. Delete Single Item


Advanced Filtering

The book supports various filtering operations:


Stored Procedure Operations

A stored procedure is a pre-written set of SQL commands that's stored in the database server and can be executed as a single unit. Think of it as a function that lives in your database instead of your application code.

Discovery

Discover a stored procedure to make it available for execution:

Or for procedures in the default schema:

Execution

Execute a discovered stored procedure:

Notes:

  • Parameter names are case-insensitive

  • Empty string values are converted to NULL

  • The procedure name in execution uses the sanitized English name generated during discovery

Last updated

Was this helpful?