Stored Procedures [dbo].[aip_shrinklog]
Properties
PropertyValue
ANSI Nulls OnYes
Quoted Identifier OnYes
Parameters
NameData TypeMax Length (Bytes)
@strDBNamenvarchar(255)510
@strLogNamenvarchar(255)510
@strLogSizeint4
Permissions
TypeActionOwning Principal
GrantExecuteaiadmin
SQL Script

CREATE    PROCEDURE    dbo.aip_shrinklog
/*    Common utility procedure to drop shadow tables
    
    2004-10-14    Yatin Dawada, Computer Associates
    2005-06-23    Change CAAIDB to mdb and removed calls to aip_procmsg


*/

(

--    DataBase Name
    @strDBName nvarchar(255) = 'mdb',



--    SQL Transaction Log File Name
    @strLogName nvarchar(255) = 'mdb_log',
    
    
--    SQL Transaction Log Size
    @strLogSize int = 1





)
AS
--      Enable NOCOUNT option to suppress unnecessary messages
        SET NOCOUNT ON

--    Declare and initialize local variables
    DECLARE @strCurCmd nvarchar(512)






--    Define SQL Query for Shrinking Log File
    SET @strCurCmd = ''
    SET @strCurCmd = @strCurCmd + 'BACKUP LOG ' + @strDBName + ' WITH   NO_LOG ' + CHAR(10)
    SET @strCurCmd = @strCurCmd + 'DBCC SHRINKFILE( ' + @strLogName + ', ' + CAST(@strLogSize AS varchar(5)) + ' ) '  + CHAR(10)

--    Execute command to open cursor for initialization information
    EXEC (@strCurCmd)






GO
GRANT EXECUTE ON  [dbo].[aip_shrinklog] TO [aiadmin]
GO
Uses