|
Home > Archive > MS SQL Server > October 2006 > Export code procedure
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Export code procedure
|
|
| carlosdoki@gmail.com 2006-10-24, 6:31 pm |
| I'd like to export code the procedure and alter the code and import
again in to the database, but this in the commandline.
Thanks,
Carlos Doki
| |
| Elyo Ravuna 2006-10-24, 6:31 pm |
| Hello Carlos,
The following script gives you the text of a given stored procedure.
-----------------
MyScript.vb
-----------------
dim cn
dim StoredProcedureLines
set cn=CreateObject("ADODB.Connection")
cn.open " Provider=SQLOLEDB;Da
ta Source=.\SQLEXPRESS;Initial
Catalog=TEST;Integra
ted Security=SSPI"
set StoredProcedureLines
=cn.execute("sp_helptext 'MyStoredProcedure'")
while not StoredProcedureLines
.eof
WScript. Echo(StoredProcedure
Lines(0))
StoredProcedureLines
.MoveNext
wend
You just need to alter the text and execute the new DROP PROCEDURE / CREATE
PROCEDURE statement. You can save this script as MyScript.vb and execute it
from the command line:
C:\>CSCRIPT MyScript.vb
I hope it helps you...
Best regards.
Elyo Ravuna
"carlosdoki@gmail.com" wrote:
> I'd like to export code the procedure and alter the code and import
> again in to the database, but this in the commandline.
>
>
> Thanks,
>
>
> Carlos Doki
>
>
|
|
|
|
|