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 2005 Forums
 Transact-SQL (2005)
 creating directory through sql server ? please...

Author  Topic 

dhani
Posting Yak Master

132 Posts

Posted - 2010-04-14 : 18:11:19
Hello All,
Please help me with this really new problem

in my c:\ drive no temp directory yet,

then now in my sql server table i have a column call directorypath with values as


c:\Temp\t1\midcap1\belzer1
c:\Temp\t1\midcap1\belzer2
c:\Temp\t1\midcap1\belzer3
c:\Temp\t1\midcap1\belzer4
c:\Temp\t1\midcap1\Delzer23
c:\Temp\t1\midcap1\Celzer22
c:\Temp\t1\midcap1\Celzer12
c:\Temp\t1\midcap1\Celzer13
c:\Temp\t1\midcap1\Celzer14
c:\Temp\t1\midcap1\Celzer15c:\Temp\t1\midcap1\Celzer16
c:\Temp\t1\midcap1\Eelzer22
c:\Temp\t1\midcap1\Eelzer23
c:\Temp\t1\midcap1\Eelzer24

how can i make any sql statement so that it creates the above directories

presently what i am doing is
1)select distinct 'mkdir "' + RTRIM(DirectoryPath) + '"' from sa.storefiles
2)then copy all entries and save in a text file and save it as .bat(batch file)
3)then execute the batch file in command prompt

but now i would like to know is there any way that i can execute directly from sql server itself to create directories (any sql statement or t-sql stuff) please

Help me

Thanks alot in advance
Dhani

DBA in the making
Aged Yak Warrior

638 Posts

Posted - 2010-04-14 : 18:25:47
You can use xp_cmdshell to execute dos commands.

------------------------------------------------------------------------------------
Any and all code contained within this post comes with a 100% money back guarantee.
Go to Top of Page

dhani
Posting Yak Master

132 Posts

Posted - 2010-04-15 : 17:22:30
Hello Guru,

Thanks i will work on it and let you know

Thanks & Regards
dhani
Go to Top of Page
   

- Advertisement -