dbTalk Databases Forums  

HELP! Stored Procedure deployment via DOS prompt

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss HELP! Stored Procedure deployment via DOS prompt in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Brandon
 
Posts: n/a

Default HELP! Stored Procedure deployment via DOS prompt - 09-15-2003 , 04:14 PM






I work at a company that does not allow me direct access
the the SQL server via a GUI environment. I need to deploy
50+ stored procedures using a .bat file and I am really
not sure how to even go about this. I am looking into the
OSQL command think this might do it but I am not sure.

Can someone PLEASE help me@!@!

Brandon
barhob (AT) yahoo (DOT) com

Reply With Quote
  #2  
Old   
Andy S.
 
Posts: n/a

Default Re: HELP! Stored Procedure deployment via DOS prompt - 09-15-2003 , 10:44 PM






The osql command is awesome! Save your the script for your stored
procedures in a .sql file. Then you can run them by doing

osql -Usa -P<password> -d<database name> -i<filename.sql> -ooutput.log

You can even make a batch file and save it on the server. The output.log
(or whatever file you choose to call it) will save whereever osql is called
unless you specify a path. Then you can see the result of trying to load
the procedures.

Your stored procedure file format should be like

CREATE PROCEDURE A
AS
BEGIN

END
GO
GRANT EXECUTE ON A TO PUBLIC
GO
CREATE PROCEDURE B
AS
BEGIN

END
GO
GRANT EXECUTE ON B TO PUBLIC
GO
<...AND SO ON FOR ALL 50+ procedures....>

If you need to change databases for a procedure do
<stored procedure a script>
GO
USE <database name>
GO
<stored procedure b>
--
*************************************
Andy S.
andy_mcdba (AT) yahoo (DOT) com

*************************************


"Brandon" <barhob (AT) yahoo (DOT) com> wrote

Quote:
I work at a company that does not allow me direct access
the the SQL server via a GUI environment. I need to deploy
50+ stored procedures using a .bat file and I am really
not sure how to even go about this. I am looking into the
OSQL command think this might do it but I am not sure.

Can someone PLEASE help me@!@!

Brandon
barhob (AT) yahoo (DOT) com



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.