March 3, 2012 at 11:00 pm
hi there,I want to search mdb files in specific path.
following query select all of files in "..\Microsoft SQL Server\MSSQL10_50.SPR2\MSSQL\DATA\.." path.
SELECT name, physical_name AS current_file_location
FROM sys.master_files
but how can I select different path? for instance c:\Db\...
something like this:
SELECT name, physical_name AS current_file_location
FROM (c:\Db\..)
any idea?
March 3, 2012 at 11:16 pm
Vahid.Ch (3/3/2012)
hi there,I want to search mdb files in specific path.following query select all of files in "..\Microsoft SQL Server\MSSQL10_50.SPR2\MSSQL\DATA\.." path.
SELECT name, physical_name AS current_file_location
FROM sys.master_files
but how can I select different path? for instance c:\Db\...
something like this:
SELECT name, physical_name AS current_file_location
FROM (c:\Db\..)
any idea?
If I am not wrong try where condition with like keyword to search the file that you want.
SELECT name, physical_name AS current_file_location
FROM sys.master_files where name like '%C:\db%'
March 4, 2012 at 11:04 am
Vahid.Ch (3/3/2012)
hi there,I want to search mdb files in specific path.following query select all of files in "..\Microsoft SQL Server\MSSQL10_50.SPR2\MSSQL\DATA\.." path.
SELECT name, physical_name AS current_file_location
FROM sys.master_files
but how can I select different path? for instance c:\Db\...
something like this:
SELECT name, physical_name AS current_file_location
FROM (c:\Db\..)
any idea?
sys.master_files doesnt' read from the operating system. It's simply a list of where all the database files are.
To find files not in this list, you'll need to use a) a DOS DIR /s command, b) a Powershell routine, c) a CLR, or d) some other method.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply