El proyecto de base de datos VS 2010 define la ruta relativa

below is my folder structure where Script.PostDeployment.sql is saved.

C:\ABC1\ABC2\Dev\Source\ABC3\ABC4\Scripts\Post-Deployment\Script.PostDeployment.sql

I want to define relative path in Script.PostDeployment.sql to run scripts from another folder. below folder has multiple scripts stored.

C:\ABC1\ABC2\Dev\DB\Scripts\Release 0\Sprint1\

will below syntax work?

:r DB\Scripts\Release 0\Sprint1\.\.\.\.\myfile.sql  

¡Gracias!

preguntado el 09 de marzo de 12 a las 16:03

1 Respuestas

The answer is "maybe". The syntax is specific to SQLCMD (:r is a SQL Command directive), but if the script is opened using SSMS, then the relative path is relative to SSMS, not the script that you are running. This can get kind of tricky. If you are only using Visual Studio or SQLCMD (command-line tool) to do the deployment, then this works. If you are going to use any other tool to do the deployment (e.g. Sql Managment Studio), then I would not use relative path.

This has cause great confusion and pain when the Developers say "It works for me" and the deployment/dba team says "it is broken".

Espero que esto ayude.

contestado el 14 de mayo de 12 a las 22:05

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.