Tuesday, March 27, 2012

Get a list of files a SQL Server instance can access

I'd like to be able to present my user with a tree view of the devices and
directories a remote SQL Server machine can access.
What I need to do is what Enterprise Manager can do: if I connect to a SQL
Server database on a remote machine to do a backup, when I come to select a
filename the browse button shows me a view of devices and directories on the
remote machine.
Is this a private trick reserved to EM or is there a way to do it with
SQL-DMO?
Thanks in advance for any help
Graham
At the TSQL level, EM uses some extended stored procedures. Run Profiler and see what they are. Not
documented, use at own risk etc.
I'm not sure whether these procedures are available through DMO, though. It would be great to have a
DMO trace tool, btw. A quick check in BOL didn't show anything obvious. The closest I could come is
the EnumDirectories method, perhaps worth using as a starting point?
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
http://www.sqlug.se/
"Graham Morris" <Graywing@.newsgroup.nospam> wrote in message
news:eVG$wvUCFHA.3976@.tk2msftngp13.phx.gbl...
> I'd like to be able to present my user with a tree view of the devices and directories a remote
> SQL Server machine can access.
> What I need to do is what Enterprise Manager can do: if I connect to a SQL Server database on a
> remote machine to do a backup, when I come to select a filename the browse button shows me a view
> of devices and directories on the remote machine.
> Is this a private trick reserved to EM or is there a way to do it with SQL-DMO?
> Thanks in advance for any help
> --
> Graham
>
|||Graham Morris wrote:
> I'd like to be able to present my user with a tree view of the
> devices and directories a remote SQL Server machine can access.
> What I need to do is what Enterprise Manager can do: if I connect to
> a SQL Server database on a remote machine to do a backup, when I come
> to select a filename the browse button shows me a view of devices and
> directories on the remote machine.
> Is this a private trick reserved to EM or is there a way to do it with
> SQL-DMO?
> Thanks in advance for any help
> --
> Graham
-- To query available drives
Execute master..xp_availablemedia 2
-- To query directories
Execute master..xp_subdirs N'C:\'
David Gugick
Imceda Software
www.imceda.com
|||Thanks - just what I need.
"David Gugick" <davidg-nospam@.imceda.com> wrote in message
news:uIERzKWCFHA.904@.TK2MSFTNGP12.phx.gbl...
> Graham Morris wrote:
> -- To query available drives
> Execute master..xp_availablemedia 2
> -- To query directories
> Execute master..xp_subdirs N'C:\'
> --
> David Gugick
> Imceda Software
> www.imceda.com
sql

No comments:

Post a Comment