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 2008 Forums
 Transact-SQL (2008)
 Exec Stored procedure through Sql agent

Author  Topic 

kond.mohan
Posting Yak Master

213 Posts

Posted - 2014-03-11 : 13:45:05
Hi all

i have created Stored procedure in SSMS 2008. like
Create proc test(@fromdate datetime,@todate datetime,@no int)
as
begin
declare @ds int
select * from .......
end

i need to Execute the Procedure using Sql agent(schduling)
how to pass the parameters using sql agent

anyone knows pls elaborate..?

Thx



tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2014-03-11 : 13:48:47
exec test @fromdate = '01/01/2014 05:00', @todate = '05/15/2014 13:00', @no 42345

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

kond.mohan
Posting Yak Master

213 Posts

Posted - 2014-03-14 : 13:34:34














Thanks Tkizer for your suggestion

exec test @fromdate = '01/01/2014 05:00', @todate = '05/15/2014 13:00', @no 42345

i cannot change my schduler dates on daily basis that means
exec test @fromdate = '@fdate', @todate = '@tdate', @no @n
where can i set @fdate , @todate,@n these parameters in schduler
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2014-03-14 : 13:39:06
Well how will you determine the values?

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

- Advertisement -