Here's a simple script generator for lazy devs like moi 😊. It generates Insert queries from a select query.
In the editor, simply select, right-click on the SQL script and click on the Generate Insert from Result
context menu, Select To Clipboard
or To New Tab
to generate query to the clipboard or a new tab respectively.
- This was done in one caffeine-fueled weekend, so pardon any bugs and prompt me by opening an issue if it acts up.
- Currently supports only
MSSQL
. - Supports any database schema if added.
- Uses the first table it finds after the
from
clause in your select query as the target table for Insert. Soselect * from table
andselect * from databaseName.dbo.table
is supported. See below for more examples.
plain old joins
select t1.* from table1 t1
inner join table2 t2 on t1.ItemID = t2.ItemID
where t1.ItemID = 10
with subqueries
select t1.* from table1 t1
where t1.ItemID in (
select top (20) t2.ItemID from table2 t2
)
- Initial release
- Added Copy to Clipbord feature
- Added support for strings with single quotes
- Added Progress notification.
- Added Settings to enable export of identity columns(Disabled by default),
to enable go to Settings page
Ctl+,
. Under theExtensions > LzScripts
section see release.
- No longer restricted to dbo.
- Generates a single insert with multiple values by default, you can disable this behavior, via the settings page,
Ctl+,
. Under theExtensions > LzScripts
, section enableAllow Insert Per Row
.
This project is licensed under the MIT License - see the LICENSE.md file for details
- This project was highly inspired by the extraSqlScriptAs Extension by pacoweb
- Much Thanks to Eugene the Sql Doctor 👌
Enjoy!