Post-deploy command-line in database project?


I have a database project in Visual Studio 2010. After the database is deployed (not after it is built) I want to execute a DOS command-line in the same way that can be done for the Post-build event.

Does anyone know how to do this?
more ▼

asked Jul 28 '11 at 08:57 AM in Default

xnl28 gravatar image

895 54 58 61

(comments are locked)
10|1200 characters needed characters left

2 answers: sort voted first

I believe the post-deployment scripts support SQLCMD syntax.

I haven't done this myself, but try calling the command line from your post deployment sql script

:!! <path-to-your-batch-file>

the list of commands supported by SQLCMD can be found in Books Online - [http://msdn.microsoft.com/en-us/library/ms162773.aspx][1]

[1]: http://msdn.microsoft.com/en-us/library/ms162773.aspx
more ▼

answered Jul 28 '11 at 09:29 AM

KenJ gravatar image

19.1k 1 3 11

(comments are locked)
10|1200 characters needed characters left

You can define a post-deploy event in the project file, even though the GUI doesn't expose this. e.g.

more ▼

answered Aug 13 '12 at 07:29 PM

craigfis gravatar image


(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

New code box

There's a new way to format code on the site - the red speech bubble logo will automatically format T-SQL for you. The original code box is still there for XML, etc. More details here.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.



asked: Jul 28 '11 at 08:57 AM

Seen: 1586 times

Last Updated: Aug 13 '12 at 07:29 PM