• We braught in the following on a few parts to ensure that we limit the possiblilty duplicates of the .mdf, .ndf and .ldf physical names and database names are not used.

    Have you considered something like that?

    We have quite a few environments and this helped to set them apart.

    DECLARE @RestoreFrom varchar(20)

    SET @RestoreFrom = '_ServerName'

    SET @restoredb = 'RESTORE DATABASE '+(select top 1 DatabaseName+@RestoreFrom from header_lester)

    UPDATE migration_lester SET physicalname = left(Physicalname,charindex('.',Physicalname)-1)+ @RestoreFrom + Right(Physicalname,4)