if ( 0 = dbo.udf_Conv_DoesIndexExist ('MwusFile','MwusFile_FileName_IX')) begin
begin try

    declare @Script nvarchar(1000)
    set @Script = '7500_102-MR3_MwusFile_FileName_IX_ExpressOnly.sql'

    declare @Step   nvarchar(1000)
    set @Step = 'Start'

 	declare @tran int 
	set @tran = @@trancount

 
	if @tran = 0    
	BEGIN TRANSACTION   
 

		set @Step = 'update dbo.MwusFile'

		update dbo.MwusFile

		  set[FileName] = (RIGHT(MUURL, CHARINDEX('/', REVERSE(MUURL)) - 1))

		set @Step = '
		create nonclustered index MwusFile_FileName_IX on dbo.MwusFile([FileName])
	'        
		exec(@Step)


	if @tran = 0  
		   COMMIT   

end try
---------------------
begin catch

    declare @ErrorMessage       nvarchar(max)
    set @ErrorMessage = [dbo].[udf_ErrorInfo_Script](@Script,@Step)

    if (XACT_STATE() != 0) 
	and @tran = 0  
		rollback transaction

    RaisError(@ErrorMessage,16,255)

end catch
end -- if ( 0 = dbo.udf_Conv_DoesIndexExist('MwusFile','MwusFile_FileName_IX'))



