Hi.
Is any way to get SQL Server 2000 data files location using TSQL?
select filename from sysfiles|||Thank you for your answer.
I have already considered this variant, but using a little other request:
select top 1 filename from model..sysfiles.
This is not very simple approach, becase then one must parse the path name and remove file name part at the end.
Well, if it is the only way to get result, I'll use it.
|||Here is the parse code:
DECLARE @.path nvarchar(260)
SET @.path = RTRIM((SELECT TOP 1 filename from model..sysfiles))
SET @.path = SUBSTRING(@.path, 1, LEN(@.path) - CHARINDEX('\', REVERSE(@.path))).
Any suggestions?
|||Can you not just take the name from sysfiles, and append the extension?
SELECT top 1 [name] + '.mdf' FROM sysfiles
|||There is no built-in method to get the data files location easily. You have to write your own to do it and your example seems fine.
No comments:
Post a Comment