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.

 All Forums
 General SQL Server Forums
 New to SQL Server Administration
 run osql/sqlcmd within a job

Author  Topic 

leoc50
Yak Posting Veteran

54 Posts

Posted - 2014-02-13 : 14:59:01
What would be simplest way to run a script using osql/sqlcmd in a Job saved in ssms? I've done it years ago but now I seem to forgotten and google doesn't ring a bell!
Thanks in advance for any ideas/suggestions!!

leo

- lec

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2014-02-13 : 16:47:40
Why do you need to use osql/sqlcmd? Just put the script contents into a TSQL job step. You can still use osql/sqlcmd, just change the job step type to cmdexec. I'd just use TSQL though.

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

leoc50
Yak Posting Veteran

54 Posts

Posted - 2014-02-13 : 18:50:46
Hi! thanks for replying!!
The reason is cuz I am planing in using this "job" as a generic job (that can be schedule at diff. times and most importantly different scripts). So the plan was to create a sproc with the script as inpit and file name for the 'result in text' ... this is why they (developers) wanted and I am tired of doing it manually.

Thanks again for the input/reply and I'll take your ideas in consideration when I get back into implementing this sproc.

Leo

- lec
Go to Top of Page
   

- Advertisement -