tl;dr: I'm looking for the equivilant of !! sqlcmd -S $(Server) -o foo.sql -d $database -Q "EXEC sp_generate_merge 'table_name'" in a SSDT post deploy script, but !! doesn't seem to be supported.

I have a SSDT database project with tables of "static data" that I populate via MERGE statements in the post deploy script. Many of these tables are reverse engineered from I found this article about using :r foo.sqlto have multiple files for post deploy.

I'd like to take this another step. I'd like generate the the merge statement by calling sp_generate_merge from a reference database on a remote server, and then executing the resulting merge statement on my database. I could use !! SHELL_CMD in sqlcmd or SSMS with SQLCMD mode enables, but that does not work in SSDT. What are my options?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.