T sql question - Sajha Mobile
SAJHA MOBILE
T sql question
Posts 2 · Viewed 5858 · Go to Last Post
spring123
· Snapshot 0
Like · Likedby · 0
How can I do this?
I want to create a store proc which execute the result of:
Select name from sysjobs where name like 'myjobABC%'
Another words, just say the result of above is name = "myjobABC02018"
then I want
EXEC dbo.sp_start_job 'myjobABC02018'
phone
· Snapshot 104
Like · Liked by · 0
Hey @spring123,
Try this:-

CREATE PROCEDURE dbo.sp_start_job
@name nvarchar(30)
AS
Select name from sysjobs where name = @name
Go

EXEC dbo.sp_start_job 'myjobABC02018';
GO

OR(using wildcard)

CREATE PROCEDURE dbo.sp_start_job 
@name nvarchar(30)
AS
Select name from sysjobs where name Like + @name +'%'
Go

EXEC dbo.sp_start_job 'myjobABC%'; 
GO
Last edited: 27-Jul-18 02:45 PM
Please log in to reply to this post

You can also log in using your Facebook
View in Desktop
What people are reading
You might like these other discussions...
· Posts 1 · Viewed 43
· Posts 4 · Viewed 281
· Posts 2 · Viewed 290
· Posts 1 · Viewed 65
· Posts 1 · Viewed 91
· Posts 1 · Viewed 67
· Posts 1 · Viewed 113
· Posts 2 · Viewed 314
· Posts 12 · Viewed 1809
· Posts 1 · Viewed 121



Your Banner Here
Travel Partners
Travel House Nepal