sql server management Studio Generate scripts - programatically

Jan Vávra 251 Reputation points
2021-03-15T15:09:25.773+00:00

Is there a way to to "generate" source of commnads of Generate Scripts dialogue? Eg. I have 200 tables but I want to export only 60 of them and I do not like to click it manually. I have a txt list of table.

If it were a tsql commnad icon like on another dialogues, it would be perfect. I would be able to findstr -v and skip tables I do not want to export...
And also customer wouldn't make a mistake by forgetting eg. Create Indexes option etc etc.

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
12,755 questions
0 comments No comments
{count} votes

Accepted answer
  1. tibor_karaszi@hotmail.com 4,301 Reputation points
    2021-03-15T15:20:22.287+00:00

    There's not a TSQL way to do this. In the end, the functionality exists in the SMO api, and also accessible using SSIS. And I also think that Export-DbaScript in dbatools acts as a wrapper for this SMO class. Unless you prefer SSIS or some other programming language, I'd investigate powershell first.


0 additional answers

Sort by: Most helpful