Solved

Creating a Directory using TSQL

Posted on 2002-03-19
2
1,060 Views
Last Modified: 2012-06-27
Hello all,

  Looking for the syntax to create a folder\directory on a Sql Servers hard drive for a backup to be stored in, this is a query that will be run once, creating a backup into a d:\tempbackup  directory, to then be restored as another database, then the .bak file deleted and the tempbackup directory removed also. I have the query all set up except getting sql server to somehow create the directory,can anyone help????

Regards
Chowster
0
Comment
Question by:Chowster
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 69

Accepted Solution

by:
Scott Pletcher earned 100 total points
ID: 6880645
Have you tried xp_cmdshell?  Maybe something like this:

EXEC master..xp_cmdshell 'MD d:\parent1\parent2\newdirec'

where d: is the appropriate drive letter on your system.  Not sure if this will work, but it may be worth a try.
0
 

Author Comment

by:Chowster
ID: 6880786
Already found this out, but triedto delete the question but as For some reason it has not deleted I will give you the ponts,

Many thanks for the speedy response.

Chowster
0

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Viewers will learn how the fundamental information of how to create a table.

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question