# SQL Server integration

> Connect to a Microsoft SQL Server database to query, insert, update, and delete rows using T-SQL.

- Authentication: apiKey

## Tools (13)

- **Count Rows**: Count the number of rows in a table, optionally with a WHERE filter.
- **Custom Query**: Execute any arbitrary T-SQL statement including JOINs, aggregations, subqueries, and DDL.
- **Delete Row**: Delete one or more rows from a table and return deleted rows using OUTPUT DELETED.
- **Find Row**: Look up a single row by a unique column value (e.g. email, ID).
- **Insert Multiple Rows**: Insert multiple rows in a single statement using a VALUES list with OUTPUT INSERTED.
- **Insert Row**: Insert a single row into a table and return the inserted row using OUTPUT INSERTED.
- **List Columns**: Retrieve column definitions for a specific table using INFORMATION_SCHEMA.
- **List Primary Keys**: Retrieve primary key columns for a specific table using INFORMATION_SCHEMA.
- **List Tables**: Retrieve all user tables in the database using INFORMATION_SCHEMA.
- **Select Rows**: Query rows from a table with filtering, sorting, and OFFSET/FETCH pagination.
- **Select Top N Rows**: Retrieve a limited number of rows using TOP without pagination offset.
- **Update Row**: Update one or more rows in a table and return updated rows using OUTPUT INSERTED.
- **Upsert Row**: Insert a row if it doesn't exist or update it if it does, using MERGE with OUTPUT INSERTED.

## Related prompts

- [SQL Crafter: draft, explain, and review queries from your schema](https://www.generalinput.com/prompts/sql-crafter-draft-explain-and-review-queries-from-your-schema.md)
- [Mirror HubSpot contacts into a SQL Server warehouse in real time](https://www.generalinput.com/prompts/mirror-hubspot-contacts-into-a-sql-server-warehouse-in-real-time.md)
- [Recover failed Stripe payments with SQL Server context and Gmail dunning](https://www.generalinput.com/prompts/recover-failed-stripe-payments-with-sql-server-context-and-gmail-dunning.md)
- [Slack data Q&A bot for your SQL Server database](https://www.generalinput.com/prompts/slack-data-qa-bot-for-your-sql-server-database.md)
- [Capture Typeform leads in SQL Server, score them, and alert sales in Slack](https://www.generalinput.com/prompts/capture-typeform-leads-in-sql-server-score-them-and-alert-sales-in-slack.md)
- [Morning KPI digest from SQL Server to Slack](https://www.generalinput.com/prompts/morning-kpi-digest-from-sql-server-to-slack.md)

Connect SQL Server in General Input: https://www.generalinput.com/apps/sql-server