Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 Lazy Administrator

Author  Topic 

SamC
White Water Yakist

3467 Posts

Posted - 2003-03-18 : 10:06:47
I may have asked this before - apologies to the department of redundancy department if I did.

I maintain all my stored procs in individual files. There are more the 50 or so files.

Is there any way (ala include ) that I can knit them together into a single executable to simplify installing them in a new database?

Sam

nr
SQLTeam MVY

12543 Posts

Posted - 2003-03-18 : 10:14:30
Indeed there is.
See
www.nigelrivett.com
Administering SQL Server Release Control

You can create a bat file to do it.
The format of the file is below.
You can generate this initially from the files or stored procedure names - but I usually just type them in.
If you create this file every time you do a release and save it in sourcesafe then you can check what has been changed.

this bat file should be in Procs\ReleaseScripts and will create Procs\ReleaseScripts\Procs.sql

cd ..\Procs

set fdest=..\ReleaseScripts\Procs.sql"

ECHO print 'Proc' >> "%fdest%"

ECHO use Elmcrest > "%fdest%"
set fname=

set fname=s_ConvertBinaryToChar.sql
ECHO. >> "%fdest%"
ECHO print 'processing file - %fname% ' >> "%fdest%"
TYPE "%fname%" >> "%fdest%"
set fname=s_GetSystemData.sql
ECHO. >> "%fdest%"
ECHO print 'processing file - %fname% ' >> "%fdest%"
TYPE "%fname%" >> "%fdest%"
set fname=s_DelEntry.sql
ECHO. >> "%fdest%"
ECHO print 'processing file - %fname% ' >> "%fdest%"
TYPE "%fname%" >> "%fdest%"
set fname=s_DelPaymentAmount.sql
ECHO. >> "%fdest%"
ECHO print 'processing file - %fname% ' >> "%fdest%"
TYPE "%fname%" >> "%fdest%"



==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-03-18 : 12:36:10
This is another way of doing the same thing, although nr's solution uses the same command, but this might be easier to read:

type C:\LocationOfFiles\*.* > C:\Temp\NameOfConcatenatedFile.sql


Tara

Edited by - tduggan on 03/18/2003 12:37:14
Go to Top of Page

SamC
White Water Yakist

3467 Posts

Posted - 2003-03-18 : 13:34:28
Thank you both for your suggestions.

I'm off to implement this eve. Back to you then.

Sam

Go to Top of Page
   

- Advertisement -