Nick Olsen
  • Posts: 1
  • Joined: 3/15/2016
Frequently I will select out a set of rows from a single table matching various rows that need to be deleted in a database and then will want to script that result out and save it in case it needs to be reinserted into the table after the delete. Would it be possible to generate a template that could replace the table name for the insert with the first table of the query? So for instance:

SELECT *
FROM MyTable
WHERE SomeCondition

....

Would then generate the script:

INSERT INTO MyTable (.....)
VALUES (...)


I know the stock INSERT INTO template gets me 95% the way there, but it doesn't allow me to use the table name from the SELECT statement for the table name to insert it into.

Thanks
SSMSBoost
  • Posts: 287
  • Joined: 6/30/2012
DataGrid does not have Meta-Information about source table for data (data can come from multiple tables, stored procedure, function,EXEC, etc..) so it can not be extracted and put into template. Sorry, currently this cannot be implemented.
  • You cannot post new topics in this forum.
  • You cannot reply to topics in this forum.
  • You cannot delete your posts in this forum.
  • You cannot edit your posts in this forum.
  • You cannot create polls in this forum.
  • You cannot vote in polls in this forum.