Restore database with different filename I have to restore a new back up file daily (as an agent job, after first deleting the existing db) but the file name will vary as it will include the timestamp as well. 

How can I achieve this so that the restore operation will identify the new file? The name of the file will be something like this and always in the same directory: AnyLetterGoesHere_TimeStamp.bak

Thanks all
you can create a table variable(or temp table) and insert all the .bak file metadata in that table and then fetch the row with max value of modified time.

DECLARE @FileMeta table (columns nvarchar(200));

INSERT INTO @FileMeta 
EXEC sys.xp_cmdshell 'dir D:\FolderName\*.bak';

SELECT * FROM @FileMeta 
WHERE columns not like '%volume%' 
AND columns is not null and columns not like '%bytes%';


Now you can get the creation date of the file as shown in this link, and Now from this table @FileMeta You can get the row for Max of creation date that will give you the most recent file.