ok its is Simple
Create a Stored Procedure that does a Backup like this
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
-- backup a database
ALTER PROCEDURE [dbo].[sp_BackupDatabase]
set nocount on
declare @sql varchar(4000)
select @sql = 'BACKUP DATABASE ' + ltrim(rtrim( @databasename ))
select @sql = @sql + ' TO DISK = ''' + ltrim(rtrim(@path)) + ltrim(rtrim(@filename)) + ''' '
select @sql = @sql + ' WITH INIT'
execute ( @sql )
Pass the Correct Parameters to the SP and go to SQL Management studio , under the "SQl Server Agent" , Collapse it and you will find the Job, Right Click on it and say new Job.
-->A dialog box will appear , give your job a name
--> Go to Steps on the Section on your right hand side
-->Give the name of the Step
--> leave the Type as "Transact SQL Script"
-->leave "Runas" Option as empty
-->In the Database, Choose the database that has a Stored procedure. You can create this backup database stored Procedure in the master database and choose it as it is selected now.
--> in the Command that is where you call the sp i gave and pass the parameters
exec [dbo].[sp_BackupDatabase] 'MyDatabase','C:\DestinationPath\','Mybackupname'
Thank you for posting at DotnetFunda
Mongz, if this helps please login to Mark As Answer. | Alert Moderator