Mobile Management For SQL Server(s!) - Siccolo - SQL Management Tool
Main
How to Create a Directory (Folder) ...by Siccolo...
Engineered to help you extend your support from mobile devices for Microsoft SQL Servers, Siccolo mobile management tool is a portable administration tool for Microsoft SQL Server. Siccolo is the premier GUI admin tool for Microsoft SQL Server management, control and development.

Siccolo gives you wide opportunities to perform all the necessary database admin routines such as creating, editing, dropping database objects; moreover, you can build queries, execute queries and SQL scripts, view data, export data, manage SQL Server users and their privileges, add jobs and alerts, and use a lot of other admin tools implemented to make your work with SQL Server highly enjoyable and efficient.

If you need the job done right and on time, do it with Siccolo on your team. Siccolo provides you with a number of easy-to-use features for performing the required data manipulation and server management easily and quickly.


  In many cases you a have a need retrieve certain path locations related to the SQL Server you are connected to, like the directory where SQL Server is installed in, the default data and log directory or back directory.
  Using xp_cmdshell - eXtended stored procedure provided by Microsoft and stored in the master database. This procedure allows you to issue operating system commands directly to the Windows command shell via T-SQL code. If needed the output of these commands will be returned to the calling routine.
	create procedure sp_create_directory
	(	
		@full_path varchar(500)
	)
	as
		set nocount on
	
		declare @command varchar(1000)
		set @command = 'mkdir ' + @full_path

		exec master..xp_cmdshell @command , no_output	

		set nocount off
	GO

	
Side Note:
xp_cmdshell - eXtended SQL stored procedure.
Executes a given command string as an operating-system command shell and returns any output as rows of text. Grants nonadministrative users permissions to execute xp_cmdshell. xp_cmdshell operates synchronously. Control is not returned until the command shell command completes.

Where xp_cmdshell {'command_string'} [, no_output]

For example, to retireve all the folders for a given disk path:
	create table #tmp (directory_name varchar(255))

	insert into #tmp
	exec master.dbo.xp_cmdshell "dir d:\ /B /A:D /S"

	select * from #tmp --for xml auto

	drop table #tmp
	
or to get server information:
	exec master.dbo.xp_cmdshell "net statistics server"
	

Article keywords: create procedure , set nocount on, mkdir, xp_cmdshell


Back To Articles Page

Free Mobile Management For SQL Server(s!) - Siccolo - SQL Management ToolQuestions? Suggestions? Concerns? - email me to [email protected]    Greg Dubinovsky � 2006
or share your thoughts at Siccolo Blog

web sponsor - siccolo.com. well being sponsor - Enabling clinical and operational value across the continuum of care.
Siccolo - SQL Server Management Tool For Mobile Devices is packed with built-in functionality and tools. Siccolo delivers a rich set of management tools for both DBAs and sys admins. SQL Server management has always been an area of DBA concern. The new Management Tool For Mobile Devices - Siccolo - has simple "Enterprise Manager" and the "Query Analyzer". Siccolo is a management tool for the MS SQL Server with administration capabilities and a database query tool. The administration features provide users the ability to browse database structures. An integrated query tool allows users to quickly create, edit and execute SQL queries and scripts. Siccolo also provides an export tool to allow users to easily save and email execution results. Siccolo helps database professionals save time and increase their productivity by utilizing a more efficient approach to database management - use their Windows Mobile empowered device while sipping margarita on the beach For increased security, Siccolo is configured to run under SSL with IIS authentication.