1

I want to know if there is any way for me to deploy a stored procedure (sql file) that is checked-in at VSS? I have a couple of procedures that I want to deploy to SQL Server. I'm trying to create a batch file to deploy them from VSS to SQL Server.

I want to achieve this since we would like to remove direct access to SQL Server. So that everything step we do on the procedures could be monitored.

Thanks!

EDIT:

I have also read that it's possible in Powershell. If anyone can point me to a good way to do it, that would be appreciated so much! I'm new to the VSS, Batch Files, and Powershells. So I'm a little bit confused where to start. Thanks!

This is what I have so far. But it doesn't work.

@echo off
cls

set path=C:\Program Files\Microsoft Visual SourceSafe
set ssdir=\\MySampel_VSS\VSS\SampleDB
set Recursive = Yes

set /p SName=Server Name :
set /p UName=User Name :
set /p Pwd=Password :
set /p DbName=Database Name :

set /p choice=ARE YOU SURE TO EXECUTE SCRIPTS in %DbName% (y/n) ?

if '%choice%'=='y' goto begin
goto end

:begin
if exist C:\Scripts\error.txt del C:\Scripts\error.txt

@echo on

sqlcmd -S %SName% -U %UName% -P %Pwd% -d %DbName% -I -i $/Database/SampleDB/Procedures/MySample.sql >> error.txt 2>&1

@notepad error.txt

:end
4
  • Do you want a batch file or a PowerShell script? You've tagged both, but specifically mentioned batch in the question.
    – alroc
    Commented May 20, 2013 at 15:47
  • and what have you tried so far ?
    – Endoro
    Commented May 20, 2013 at 15:53
  • sorry. that's a mistake. i want to create a batch-file. thanks! :)
    – Smiley
    Commented May 20, 2013 at 15:53
  • @Endoro i have tried playing around with a script I have that's for pinning files on VSS. I don't have prior experience to this kind of stuff so i'm basically relying on what I find on google and what I have. :( Thanks for the response!
    – Smiley
    Commented May 20, 2013 at 15:55

1 Answer 1

0

You need to use Visual Source Safe command line in a batch file to deploy a project that is checked in. Take a look at the Checkout and Deploy commands in particular.

1
  • Hi! Thanks! Will this deploy my StoredProcedure file into the Database? Because the process I want to achieve is: 1. Checkin .sql SP to VSS. 2. Create batch file to deploy .sql SP from VSS to SQL Server. 3. Check if SP exists in SQL Server. Thanks!
    – Smiley
    Commented May 20, 2013 at 18:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.