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.
Author |
Topic |
Merkin
Funky Drop Bear Fearing SQL Dude!
4970 Posts |
Posted - 2002-08-11 : 01:45:05
|
Hi all. Here is a little trick I came up with the other day. Although a bunch of yu may have already thought of it, I thought I might share it.I had a directory with about 30 .sql files in it (each one a Create Procedure statement). I needed to deploy all the files to a live database. Being the incredibly lazy person I am I didn't want to open up each file and run it.So, I dropped into DOS, went to that directory and typedtype *.sql > newfile.sqlThis created a new file that contained all of the other files, I could just run that file in query analyzer and I was done.Give it a try!Damian |
|
VyasKN
SQL Server MVP & SQLTeam MVY
313 Posts |
Posted - 2002-08-11 : 05:46:21
|
Funny you should mention it, I did the same thing on Friday for a deployment :-) Of course, I had to test the new script file on a test database, just to be sure everything is in place.--HTH,Vyashttp://vyaskn.tripod.com |
|
|
jasper_smith
SQL Server MVP & SQLTeam MVY
846 Posts |
Posted - 2002-08-11 : 10:54:10
|
I actually wrote a stored procedure to do this ( for some reason I write everything in TSQL - its a sickness) so that the formating looked okay. Since numerous developers write the procedures not evryone (including me) puts hard returns at the bottom of the scripts so when concatenated the last line of procedure 1 flows into the first line of procedure 2 which looks a bit ugly - it also allows me to add a header of who created the run script and the date .HTHJasper Smith |
|
|
Merkin
Funky Drop Bear Fearing SQL Dude!
4970 Posts |
Posted - 2002-08-11 : 11:02:07
|
There is a great tool provided with Ken Henderson's recent book that will build an SQL file out of a folder in VSS. But I was in a hurry and didn't want to install it.This was is quick and dirty, and I'm all for that Damian |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2002-08-12 : 07:30:06
|
seehttp://mysite.freeserve.com/root/Administering SQL Server Release Control6.1 Creating the scriptsThe next version of this document (which I may never get round to completing) does it all from t-sql using osql to release the version.==========================================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. |
|
|
Merkin
Funky Drop Bear Fearing SQL Dude!
4970 Posts |
Posted - 2002-08-12 : 07:40:41
|
yeah.....but....... man.....type *.sql > newfile.sql Damian |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2002-08-12 : 08:52:48
|
exec master..xp_cmdshell 'osql -Q"exec master..xp_cmdshell ''type \\MyPC\Share\testosql\*.sql > c:\osqlcmds.txt''"'exec master..xp_cmdshell 'osql -i"c:\osqlcmds.txt"'==========================================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. |
|
|
|
|
|