Generate and compare SQL Server object scripts, and monitor SQL Server Agent jobs, without leaving VS Code.
Pick a connection, pick a database, pick an object: get its script in a new editor tab, or compare the same object between two databases side by side. Open the Job Activity Monitor to follow your SQL Server Agent jobs.
Features
- Get Objects – Browse the tables, views, stored procedures, functions, triggers, synonyms, sequences, user-defined types and CLR assemblies of a database and open the script of any of them in a new SQL tab.
- Compare Objects – Compare the script of an object between two databases (same server or a different one) in VS Code's diff editor. You can compare against the object with the same name or choose a different one (for example
sp_a against sp_b).
- Job Activity Monitor – A panel to follow the SQL Server Agent jobs of a server: status, last run, duration, next run, schedules, steps and history, with filters, search and auto-refresh. You can also start, stop, enable and disable jobs.
- Complete table scripts – Columns, primary key, foreign keys, unique, check and default constraints, indexes and triggers.
- One connection for scripts – Connect once; Get Objects and Compare Objects reuse the same connection until you refresh it. The Job Activity Monitor keeps its own.
- SQL Server Authentication and Windows Authentication – Windows Authentication works without typing a user or password.
- Reuses your existing profiles – Connection profiles are read from the
mssql.connections setting (the ones you already created with the SQL Server (mssql) extension), listed alphabetically.
- Passwords stay secure – For SQL Server Authentication, the password is asked once and stored encrypted in VS Code's secret storage.
Job Activity Monitor
Open the Command Palette (F1) and run SQL Script Toolkit - Job Activity Monitor, or press Ctrl+Alt+J. Choose a connection profile (it is not asked when there is only one, and no database is needed: the jobs are read from msdb).
| You see |
Details |
| Job list |
Name, status (Running, Failed, Succeeded, Retry, Canceled, Never run), last run, duration and next run. Click a column to sort; the default order is by name. Disabled jobs are marked. |
| Filters and search |
Failed, Running, Succeeded, Enabled and Disabled, with counters. You can combine several filters. The search box filters by name and keeps its text when you refresh. |
| Auto-refresh |
Every 15, 30, 45, 60 (default), 90 or 120 seconds. The list stays visible while it refreshes, and it pauses while the tab is hidden. |
| Job details |
Click a job to see its owner, category, creation and modification dates and description (hover it to read it all), its schedules in plain text, its steps and its history. |
| History |
Grouped like SSMS: one row per run with the result and total duration, and inside it the detail of each step. |
| Open command |
Opens the command of a step in a new tab, fully commented so it cannot be run by accident, with the job, the step and the database it points to. |
Actions (···) |
Start or stop a job, enable or disable it, copy its name or ID. Start, stop, enable and disable always ask for confirmation first. |
| Change connection |
Button in the panel, or the command SQL Script Toolkit - Job Activity Monitor: Change Connection. |
Permissions: reading the jobs requires access to msdb (for example the SQLAgentReaderRole role). Starting, stopping, enabling and disabling jobs requires SQLAgentOperatorRole, being the owner of the job, or sysadmin.
Requirements
- VS Code 1.107.0 or later, or another editor based on a compatible version (for example Antigravity IDE).
- SQL Server 2008 or later. Sequences exist from SQL Server 2012.
- At least one connection profile in the
mssql.connections setting (created with the SQL Server (mssql) extension, or added manually to your settings.json).
- Windows Authentication only: the
sqlcmd command-line tool must be installed and reachable from your PATH.
- It is included with the SQL Server command-line utilities, or you can install it with
winget install sqlcmd.
- If it is installed somewhere else, set
sqlScriptToolkit.sqlcmdPath.
Getting started
- Open the Command Palette (
F1 or Ctrl+Shift+P).
- Run SQL Script Toolkit - Get Objects (or Compare Objects, or Job Activity Monitor).
- Choose a connection profile and then a database.
- SQL Server Authentication profiles ask for the password the first time.
- Windows Authentication profiles connect directly.
- With a single profile, it is used without asking.
- Choose an object. The script opens in a new tab (Get Objects), or the diff opens after you choose the second database (Compare Objects).
Commands
| Command |
What it does |
| SQL Script Toolkit - Get Objects |
Lists the objects of the selected database and opens the script of the one you choose. |
| SQL Script Toolkit - Compare Objects |
Compares an object between two databases in the diff editor. |
| SQL Script Toolkit - Refresh Connection |
Forgets the current connection, asks for a new profile and database, and then asks whether you want to get an object script or compare objects. |
| SQL Script Toolkit - Job Activity Monitor |
Opens the monitor of the SQL Server Agent jobs. |
| SQL Script Toolkit - Job Activity Monitor: Change Connection |
Switches the monitor to another connection. |
Keyboard shortcuts
| Command |
Default shortcut |
Previous shortcut* |
| Get Objects |
Ctrl+Alt+G |
Ctrl+T |
| Compare Objects |
Ctrl+Alt+C |
Ctrl+K |
| Refresh Connection |
Ctrl+Alt+R |
– |
| Job Activity Monitor |
Ctrl+Alt+J |
– |
*On first run the extension asks which set you prefer. You can switch at any time with the sqlScriptToolkit.useLegacyShortcuts setting, and you can remap any shortcut in Keyboard Shortcuts.
Table scripts
The script of a table has the columns in CREATE TABLE and then, separated by the batch separator, these statements in this order: primary key, foreign keys, unique constraints, check constraints, default constraints, indexes and triggers. Indexes and triggers can be turned off with sqlScriptToolkit.includeTableIndexes and sqlScriptToolkit.includeTableTriggers, and they also apply to Compare Objects.
Extension settings
| Setting |
Default |
Description |
sqlScriptToolkit.defaultPort |
1433 |
Port used when the profile does not specify one (applies to every feature). |
sqlScriptToolkit.includeDatabase |
true |
Add USE [database] and the batch separator at the top of generated and compared scripts. |
sqlScriptToolkit.batchSeparator |
GO |
Batch separator written after USE [database], at the end of the scripts and between the statements of a table script. |
sqlScriptToolkit.useAlter |
false |
Convert CREATE into ALTER in generated scripts (procedures, functions, triggers and views). |
sqlScriptToolkit.clearConnectionAfterGenerateScript |
false |
Forget the connection after generating a script or running a comparison. |
sqlScriptToolkit.compareObjectMode |
sameName |
Object to compare against in the second database: sameName (same name), ask (always ask) or different (always choose another object). |
sqlScriptToolkit.compareSameTypeOnly |
false |
When choosing another object to compare, list only objects of the same type. |
sqlScriptToolkit.askObjectType |
false |
Ask for the object type before listing the objects. Recommended for databases with thousands of objects: the list is much shorter, so it is faster and smoother to browse. |
sqlScriptToolkit.includeTableIndexes |
true |
Include the indexes of a table in generated and compared scripts. |
sqlScriptToolkit.includeTableTriggers |
true |
Include the triggers of a table in generated and compared scripts. |
sqlScriptToolkit.requestTimeout |
60 |
Seconds to wait for a query before giving up (0 = no limit). The connection timeout is 30 seconds. |
sqlScriptToolkit.sqlcmdPath |
sqlcmd |
Path to sqlcmd (Windows Authentication only). |
sqlScriptToolkit.sqlcmdTrustServerCertificate |
true |
Pass -C to sqlcmd to trust the server certificate (Windows Authentication only). |
sqlScriptToolkit.useLegacyShortcuts |
false |
Use the previous shortcuts (Ctrl+T / Ctrl+K) instead of the new ones. |
Security and privacy
- No telemetry. The extension only talks to the SQL Server you choose.
- Passwords are stored in VS Code's encrypted secret storage, never in settings files. If a login fails, the saved password is discarded and you are asked again.
- Connections are encrypted, but the server certificate is not validated (
trustServerCertificate), which is common for internal servers with self-signed certificates.
- Get Objects, Compare Objects and the views of the Job Activity Monitor only read: they run
SELECT queries and never modify your databases.
- The only operations that change the server are the job actions of the monitor (start, stop, enable and disable). Each one asks for confirmation before running.
- Because it reads connection profiles from settings and can use your Windows credentials, it is disabled in untrusted workspaces.
Troubleshooting
| Message |
What to do |
No connection profiles found in mssql.connections |
Create a profile with the SQL Server (mssql) extension or add one to your settings.json. |
Authentication type "..." is not supported |
Only SQL Login and Windows (Integrated) profiles are supported. Azure/Entra ID (MFA) is not. |
sqlcmd not found |
Install sqlcmd or set sqlScriptToolkit.sqlcmdPath (Windows Authentication only). |
Timeout: Request failed to complete... |
The query took longer than the allowed time. Increase sqlScriptToolkit.requestTimeout. |
| The monitor shows a permission error |
The login needs access to msdb (SQLAgentReaderRole). To start, stop, enable or disable jobs it needs SQLAgentOperatorRole. |
| Login fails after a password change |
Run Refresh Connection (or Job Activity Monitor: Change Connection); you will be asked for the new password. |
Object "..." does not exist in the second database |
The object was not found with the same schema and name in the other database. Use Choose another object. |
Known limitations
- Objects are listed and looked up with their schema (
schema.name). When comparing against the same object in the other database, the schema must match too; if it does not, use Choose another object.
- Table scripts do not include index options (such as fill factor), filegroups, partitions, columnstore, XML or spatial indexes, or column options such as
SPARSE.
- The script of a CLR assembly includes the binary in hexadecimal, so it can be very long.
- The Job Activity Monitor cannot create, edit or delete jobs yet.
- The script of a user-defined table type (
CREATE TYPE ... AS TABLE) includes its columns, primary key and unique constraints, but not its default or check constraints. Defaults and checks of regular tables are fully supported.
- Azure Active Directory / Entra ID (MFA) authentication is not supported.
Migrating from SQL Script Generator / SQL Script Compare
This extension replaces both. Uninstall the old ones to avoid duplicate commands and settings, and use:
- SQL Script Generator → SQL Script Toolkit - Get Objects
- SQL Script Compare → SQL Script Toolkit - Compare Objects
- Both Refresh Connection commands → SQL Script Toolkit - Refresh Connection (old keyboard shortcuts pointing to the previous refresh commands keep working).
Settings now live under a single sqlScriptToolkit.* prefix. The old sqlScriptGenerator.* and sqlScriptCompare.* settings are not read anymore, so re-apply any custom values with the new names (includeUseDatabase in both old extensions is now sqlScriptToolkit.includeDatabase, and both "clear connection" options are now sqlScriptToolkit.clearConnectionAfterGenerateScript).
Release notes
See CHANGELOG.md.
| |