Solved

Using SQLCMD in Visual Studio to run sql scripts NOT IN a database project

Posted on 2011-09-22
1
522 Views
Last Modified: 2012-12-04
Hi

I am part of a team using Visual Studio/Team Foundation Server to manage database development.

We are using a database project to manage schema changes.

We have a folder in TFS, not in the database project where we keep run-once-only scripts to update metadata/config data. We see no reason in keeping these in the Pre/PostDeployment script area of the database project as these files will not be updated once they have been run.

My question is: is there a way to refer to files in a TFs folder, so that I can create a single deployment script with something like:

:r "$/MyProject/MetaDataScripts/Release1/Script1.sql"
:r "$/MyProject/MetaDataScripts/Release1/Script2.sql"

where the path is refering the source location in TFS Source Control Explorer?

Thanks
0
Comment
Question by:dalsandhu
1 Comment
 
LVL 39

Accepted Solution

by:
lcohan earned 500 total points
Comment Utility
As long as all access is in place at folder and SQL database lever for the NT/SQL login(s) that are running the SQL scripts I can't see why not. All you need to provide is the full path to the SQL script file and make sure folder/db access is in place.

http://msdn.microsoft.com/en-us/library/ms170572(v=SQL.100).aspx
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now