June 17, 2009 at 10:56 pm
Hi
I wat to find the exact datafile path using SMO.But when i tried it gives upto
c:/pf/miscosoftsqlserever/../../data.
But i need to display the exact path
c:/pf/miscosoftsqlserever/../../data/master.mdb
How to do this ??
Thanks in advance.
June 18, 2009 at 12:14 am
Show us what code you already have.
[font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
Proactive Performance Solutions, Inc. [/font][font="Verdana"] "Performance is our middle name."[/font]
June 18, 2009 at 2:14 am
You were probably using the .MasterDBPath property, which gives you exactly what it says, the PATH.
If you want the whole file name you will need to use something like this .Databases("master").FileGroups(0).Files(0).FileName
I have used FileGroups(0) and Files(0) in this example, but don't forget, databases can have more than 1 filegroup, and more than 1 physical file in a filegroup, so you will need to enumerate both the Filegroups and Files collections to get the full list of files for a database.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply