[dba-SQLServer] Running Sprocs using a batch file that isthenexecuted in aNetwork Job Scheduler

Francisco H Tapia my.lists at verizon.net
Mon Jan 12 18:15:05 CST 2004


There is no need for a DSN... you are connecting directly to the server 
for instance:
Your batch would contain:

osql -S SQLServerName -U UidName -P password -Q "Exec 
databasename.dbo.sproc Parameter1, Parameter2, etc"
osql -S SQLServerName2 -U UidName -P password -Q "Exec 
databasename.dbo.sproc2 Parameter1, Parameter2, etc"
osql -S SQLServerName3 -U UidName -P password -Q "Exec 
databasename.dbo.sproc3 Parameter1, Parameter2, etc"


You can also run a sproc from one sql server from another but you'd have 
to set up a linked server within a particular sql server such as then 
you would only need to run your batch like this...

osql -S SQLServerName -U UidName -P password -Q "Exec 
databasename.dbo.sproc Parameter1, Parameter2, etc"
osql -S SQLServerName -U UidName -P password -Q "Exec 
LinkedServer2.databasename.dbo.sproc2 Parameter1, Parameter2, etc"
osql -S SQLServerName -U UidName -P password -Q "Exec 
LinkedServer3.databasename.dbo.sproc3 Parameter1, Parameter2, etc"

-- 
-Francisco


Stoker, Kenneth E wrote:

>I have been looking everything I can find on osql, but I cannot find
>anything about using a dsn.  There are switches for supplying a username
>and password, but not a dsn.  Is it possible to supply a dsn instead?
>What would the switch be?
>
>Ken Stoker
>Technology Commercialization
>Information Systems Administrator
>PH: (509) 375-3758
>FAX: (509) 375-6731
>E-mail:  Kenneth.Stoker at pnl.gov 
>
>
>-----Original Message-----
>From: Francisco H Tapia [mailto:my.lists at verizon.net] 
>Sent: Monday, January 12, 2004 2:25 PM
>To: dba-sqlserver at databaseadvisors.com
>Subject: Re: [dba-SQLServer] Running Sprocs using a batch file that
>isthenexecuted in aNetwork Job Scheduler
>
>
>i hear ya, it can be done using osql, check BOL for syntax
>
>
>
>  
>



More information about the dba-SQLServer mailing list