July 13, 2009 at 5:58 pm
I have some of the commands in my SP like below but not able to use 'Use Database' option , any workaround?
sp_helpfile
sp_start_job
July 13, 2009 at 6:07 pm
Hi,
Just want to make sure that I got you question right.
Do you mean you are getting some kind of error message when you are trying to execute sp_helpfile and sp_start_job. If yes, then can you please give the error message.
July 13, 2009 at 6:10 pm
If I read your question right you are trying to do a USE statement in a sproc and it won't let you. MY guess is that you are doing a USE msdb so you can execute the start job.. You can reference the sproc in the database directly..
EXEC databasename.dbo.sprocname
or
EXEC databasename..sprocname
I recommend the first way, it performas faster, or at least MS says it does..
CEWII
July 13, 2009 at 7:23 pm
Guys you rock ,thnx
July 17, 2009 at 12:44 am
it looks like i am stuck with dbcc shrinkfile , any idea how i can use the database name in the stored procedure for dbcc shrinkfile with specific db?
July 19, 2009 at 9:20 pm
DECLARE @varname varchar(255)
SELECT @varname = 'DBCC SHRINKFILE( ' + @FileNameWeGotSomewhereElse + ' ) '
EXEC ( @varname )
Comes to mind..
CEWII
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply