T sql question - Sajha Mobile
SAJHA MOBILE
T sql question
Posts 2 · Viewed 5913 · 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 4 · Viewed 267
· Posts 10 · Viewed 830 · Likes 1
· Posts 9 · Viewed 1234
· Posts 1 · Viewed 90
· Posts 1 · Viewed 100
· Posts 1 · Viewed 84
· Posts 12 · Viewed 636
· Posts 25 · Viewed 4040 · Likes 2
· Posts 3 · Viewed 674
· Posts 3 · Viewed 610



Your Banner Here
Travel Partners
Travel House Nepal