Extension: SqlLens SQL Server Tools · Publisher: sqllens · Version 0.0.2+
Install: Visual Studio Marketplace
The SqlLens VS Code extension brings SQL Server dependency analysis directly into your editor workflow. Analyze stored procedures, views, functions, and tables without leaving VS Code — and connect to the same SqlLens account you use in the Desktop application.
Note: The VS Code extension and the Desktop application share the same account and server connections. Features unique to the Desktop (Mermaid diagrams, AI code review, database compare, Agent Jobs) are listed in the Feature Comparison.
Ctrl+Shift+X)Recommended: Install SQL Server (mssql) to unlock right-click analysis from the mssql Object Explorer.
Open Command Palette (Ctrl+Shift+P):
SqlLens: Login
Enter your SqlLens email and password. No account yet? Run SqlLens: Register first.
SqlLens: Add Server
| Field | Example |
|---|---|
| Server name | localhost or .\SQLEXPRESS |
| Database | MyDatabase |
| Username | sa (SQL auth) |
| Password | your password |
Click the SqlLens icon in the Activity Bar (left sidebar) to open the Server Explorer panel. Expand a server to browse databases and objects.
▶ localhost
└── MyDatabase
├── Stored Procedures
│ └── dbo.GetOrderSummary [graph icon]
├── Views
│ └── dbo.vw_ActiveOrders [graph icon]
├── Functions
│ └── dbo.fn_FormatDate [graph icon]
└── Tables
└── dbo.Orders [graph icon]
Toolbar:
Right-click a database: Search Objects · Compare with Git
Right-click a stored procedure / view / function / table: Analyze Dependencies
Three ways to trigger:
1. From Server Explorer
Right-click any stored procedure, view, function, or table → Analyze Dependencies
2. From mssql Object Explorer
Right-click any object in the mssql extension tree → SqlLens: Analyze Dependencies
(Supports: Tables, Views, Stored Procedures, Scalar Functions, Table-Valued Functions)
3. From SQL editor selection
Highlight an object name in any .sql file → right-click → SqlLens: Analyze SQL Object Dependencies
(File must be .sql or mssql language and have an active selection)
SqlLens: Search Across Databases
Searches all databases on the connected server simultaneously. Results show database, schema, object name, and type. Also accessible via the 🔍 toolbar icon or right-click on a database node.
SqlLens: Compare Database with Git
Diffs stored procedure definitions in your live database against versions committed in your mapped Git repository. Shows added, modified, and deleted objects. Requires GitHub PAT and a server → repo mapping (see Git Setup below).
SqlLens: Configure Batch Review Notifications
Schedule automated AI analysis jobs on a set of SQL objects. Configure frequency, target objects, and notification preferences. Results are delivered as VS Code notifications.
SqlLens: Explore GitHub Repo Structure
Browse the folder and file tree of your mapped GitHub repository from inside VS Code.
SqlLens: Configure GitHub PAT
Enter a GitHub Personal Access Token with repo scope. Required for Compare with Git, Explore Repo Structure, and Batch Review.
SqlLens: Manage GitHub Mappings
Map each SQL Server instance to a GitHub repository (ServerName → owner/repo-name).
Organize servers by environment (Development, Staging, Production):
| Command | Description |
|---|---|
SqlLens: Select Environment |
Switch active environment |
SqlLens: Create New Environment |
Add a new environment |
File → Preferences → Settings → search SqlLens:
| Setting | Default | Description |
|---|---|---|
sqllens.azureFunctions.baseUrl |
https://sqllens-functions.azurewebsites.net |
Backend API URL |
sqllens.azureFunctions.functionKey |
(empty) | API key (from account registration) |
sqllens.connections |
[] |
Saved SQL Server connections |
| Command | Description |
|---|---|
SqlLens: Login |
Sign in |
SqlLens: Register |
Create account |
SqlLens: Logout |
Sign out |
SqlLens: Show User Info |
Display account details |
SqlLens: Add Server |
Add SQL Server connection |
SqlLens: Remove Server |
Remove saved connection |
SqlLens: Update Server Password |
Update credentials |
SqlLens: Connect to SQL Server |
Select active connection |
SqlLens: Select Environment |
Switch environment |
SqlLens: Create New Environment |
Add environment |
SqlLens: Analyze Dependencies |
Analyze object from Explorer |
SqlLens: Analyze SQL Object Dependencies |
Analyze highlighted SQL in editor |
SqlLens: Search Across Databases |
Cross-database search |
SqlLens: Compare Database with Git |
Diff live DB vs Git |
SqlLens: Configure GitHub PAT |
Set GitHub token |
SqlLens: Manage GitHub Mappings |
Map servers to repos |
SqlLens: Configure Batch Review Notifications |
Schedule AI review |
SqlLens: Explore GitHub Repo Structure |
Browse mapped Git repo |
SqlLens: Check Key Vault Credentials |
Diagnostic: Key Vault access |
SqlLens: Test mssql Extension Integration |
Diagnostic: mssql connection |
No default bindings assigned. Add via File → Preferences → Keyboard Shortcuts → search SqlLens:
{ "key": "ctrl+shift+d", "command": "sqllens.analyzeDependencies" },
{ "key": "ctrl+shift+s", "command": "sqllens.searchDatabases" }
Cannot connect to SQL Server
localhost, .\SQLEXPRESS, or SERVER\INSTANCESqlLens: Update Server Password if credentials changed"Not logged in" errors
SqlLens: Login — sessions expire periodicallymssql right-click menu not showing
Compare with Git returns no results
SqlLens: Configure GitHub PAT) with repo scopeSqlLens: Manage GitHub Mappings)| Resource | Link |
|---|---|
| 🖥️ Desktop Application | Download |
| 📊 Desktop vs VS Code Feature Comparison | Feature_Comparison.md |
| 🔍 Full Desktop Reference Guide | https://sqllens.blob.core.windows.net/downloads/docs/guides/SqlLens_Reference.html |
| 🐛 Report Issues | GitHub Issues |
Part of the SqlLens SQL Server Analysis & Visualization toolset by Thoughts In Motion