Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Creating a Directory using TSQL

Posted on 2002-03-19
2
Medium Priority
?
1,063 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 70

Accepted Solution

by:
Scott Pletcher earned 200 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

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

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

I have a large data set and a SSIS package. How can I load this file in multi threading?
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

722 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