• it is a procedure that is called in the backup job

    create procedure sp_bakdb

    @dbname sysname ---name of the db to be backed up

    @backuplocationpath nvarchar(256) ---unc path to location of the backed up database/log files

    @baktyp varchar (20) ---backup type (full or log)

    as

    declare @backupfilename = @backuplocationpath + '\' + <someformat>

    set @dbname = lower@dbname

    set @backuplocationpath = @backuplocationpath

    ---backup the database/log to the specified location

    print 'Backing up ' + @dbname + ' to disk: ' + @backuplocationpath

    if @baktyp = 'FULL'

    backup database @dbname to disk=@backuplocationpath

    else

    begin

    backup log @dbname to disk=@backupfilename

    end

    ------------------------------

    all parameters are given.