Solved

Creating a Directory using TSQL

Posted on 2002-03-19
2
1,058 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
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
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.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

860 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