Copy As SQL is a simple Visual Studio extension that adds a context menu command to the Output Window.
It allows you to quickly transform parameterized SQL queries into raw SQL by replacing all parame
Copy as SQL is a Visual Studio extension that helps you quickly extract executable SQL queries from the Output Window.
When you debug applications, the Output Window often displays SQL statements with parameter placeholders (e.g., @p1, @p2) and their corresponding values. Manually replacing those parameters can be tedious — that's where this extension comes in.
How it works:
Select a SQL block in the Output Window.
Right-click and choose "Copy as SQL".
The extension replaces parameters with their actual values and copies the final SQL to your clipboard.
Paste the ready-to-run SQL anywhere you want (SSMS, Azure Data Studio, etc.).
Example:
Before
SELECT * FROM Users WHERE Id = @p0
-- @p0: Input Int32 [1]
After
SELECT * FROM Users WHERE Id = 1
Key features:
Supports int, bigint, string, datetime, guid, bit, and more.
Automatically handles NULL values.
Escapes strings properly to avoid SQL injection issues.