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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 really dumb question

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2004-03-04 : 08:16:55
John submitted "This is a really dumb question but how do I actually run a proc in SQL. I have inherited a database with stored procs of which i need to run two every month but have no idea how to run it."

drymchaser
Aged Yak Warrior

552 Posts

Posted - 2004-03-04 : 08:26:45
From Books Online.

quote:
[ [ EXEC [ UTE ] ]
{
[ @return_status = ]
{ procedure_name [ ;number ] | @procedure_name_var
}
[ [ @parameter = ] { value | @variable [ OUTPUT ] | [ DEFAULT ] ]
[ ,...n ]
[ WITH RECOMPILE ]



Basically

EXEC [databasename.][owner.]procedurename
Go to Top of Page

Frank Kalis
Constraint Violating Yak Guru

413 Posts

Posted - 2004-03-04 : 08:34:22
To add to this, if these s_procs ought to be executed on a regular basis, you might want to consider creating a job for them.


Frank
Go to Top of Page

nfsoft
Starting Member

36 Posts

Posted - 2004-03-04 : 10:02:12
Basic steps are:
create a package - in Data Transformation Services (DTS) > local Packages > [new Package]
...create a connection [Microsoft OLE DB Provider for SQL Server] (config it correctly)
...Add task [Execute SQL Task]
......(code it like drymchaser instructed)
...Save (you can leave owner pass in blank)
...Exit the package eitor
---
now you have a new package in your local package folder.
right click it to shedule the package and "voila".
Note the user (SERVER\user)on the package... you may experience some problems due to lacal a remote setings.
To avoid this (and if you can) build the packages in the server.
Hope helps...

Nuno Ferreira
Go to Top of Page

JohnDeere
Posting Yak Master

191 Posts

Posted - 2004-03-05 : 01:10:25
you can also execute the prodecure directly in query analyzer.

Lance Harra
Go to Top of Page

AjarnMark
SQL Slashing Gunting Master

3246 Posts

Posted - 2004-03-05 : 18:31:25
quote:
Originally posted by nfsoft

Basic steps are:
create a package - in Data Transformation Services (DTS) > local Packages > [new Package]

Nuno, you don't need to put it into a DTS package in order to schedule it. You can just create a new job with Transact-SQL steps.

--------------------------------------------------------------
Find more words of wisdom at [url]http://weblogs.sqlteam.com/markc[/url]
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-03-05 : 18:33:39
quote:
Originally posted by AjarnMark

quote:
Originally posted by nfsoft

Basic steps are:
create a package - in Data Transformation Services (DTS) > local Packages > [new Package]

Nuno, you don't need to put it into a DTS package in order to schedule it. You can just create a new job with Transact-SQL steps.

--------------------------------------------------------------
Find more words of wisdom at [url]http://weblogs.sqlteam.com/markc[/url]



Yep. Keep DTS out of this. Too much overhead for just running stored procedures. Now if you want to export data to Excel or something that doesn't involved pure T-SQL, then perhaps DTS could be used.

Tara
Go to Top of Page
   

- Advertisement -