Import existing stored procedures into SQL Server

I restored my development database from production, and the stored procedures that I need in my development environment do not exist in my production database. Is there a command that Ii can use to import developmetn stored procedures back to SQL Server. There are about 88 files, since each procedure is in a different text file.

TIA! Chris

+5
source share
6 answers

Unfortunately, you made a painful way to generate scripts. You must create one script procedure for all procedures by right-clicking on the database in SSMS, choosing "Tasks โ†’ Generate Scripts".

However, if you do not want to go through this process again, open the cmd shell in the folder and remember those old days of batch files:

for %f in (*.sql) do sqlcmd -i %f

That should do the trick! You can add other parameters to sqlcmd if necessary (e.g. login, password, server name, ...). To see the list of switches, just follow sqlcmd -h.

+9
source

For SQL 2K and 2K5 you want this tool .

I asked a similar question a while ago and got this advice from Mike L. (give him votes here ).

+1
  • , .
  • (, )
  • , ( )
+1

Hit Generate SQL Scripts, . , , .

.

0

, , , , create , , .

0

sql , out.sql, SQL. , END .sql, , *.sqlsettings.

.sql. , out.sql, .

del out.sql && for /f %f in ('dir /b /s ^| findstr /E \.sql') do type %f >> out.sql
0

All Articles