Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2012 Forums
 Transact-SQL (2012)
 How to open a folder and select a file ?

Author  Topic 

MohamedAliSalim
Starting Member

9 Posts

Posted - 2015-02-23 : 06:35:25
hi all
i wanna query that take filename to open the folder and select the target file

like "Show In Folder" in Google Chrome

Thanks

Mohamed Ali Salim

gbritton
Master Smack Fu Yak Hacker

2780 Posts

Posted - 2015-02-23 : 07:50:31
a query by itself cannot do that. You also need codes to interact with Windows to open a directory selection window.
Go to Top of Page

Vinnie881
Master Smack Fu Yak Hacker

1231 Posts

Posted - 2015-02-23 : 17:33:16
You would do this on the front end. IF you are using .net look into OPENFILEDIALOG


Vincent Senese


Success is 10% Intelligence, 70% Determination, and 22% Stupidity.
\_/ _/ _/\_/ _/\_/ _/ _/- 881
Go to Top of Page

viggneshwar
Yak Posting Veteran

86 Posts

Posted - 2015-02-24 : 03:26:27
execute the command xp_cmdshell 'dir'
The above command gives the list of files and folders in the given folder path

Regards
Viggneshwar A
Go to Top of Page

MohamedAliSalim
Starting Member

9 Posts

Posted - 2015-02-25 : 08:21:25
thanks all

i tried xp_cmdshell but there is an error

SQL Server blocked access to procedure 'sys.xp_cmdshell' of component 'xp_cmdshell' because this component is turned off as part of the security configuration for this server. A system administrator can enable the use of 'xp_cmdshell' by using sp_configure. For more information about enabling 'xp_cmdshell', search for 'xp_cmdshell' in SQL Server Books Online.

Mohamed Ali Salim
Go to Top of Page

gbritton
Master Smack Fu Yak Hacker

2780 Posts

Posted - 2015-02-25 : 17:39:53
you cant select files with dir anyway. its not what you want. vinnie has the right hint
Go to Top of Page
   

- Advertisement -