| Author |
Topic |
|
sqllearner
Aged Yak Warrior
639 Posts |
Posted - 2004-10-04 : 12:33:40
|
| Hi all,Iam facing a problem where I have to create folders according to a list of ids..eg: emp_id101102103178 Here according to the list of emp_id from emp_detail table I have to create folders for each Id and validate if the same folder present then should not create else I should create folder to a specified directory say D:\EMP |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2004-10-04 : 13:49:56
|
| So what code are you using and what is the error? And you do know that the folder would be created on the database server if you use SQL Server to do this?Tara |
 |
|
|
sqllearner
Aged Yak Warrior
639 Posts |
Posted - 2004-10-04 : 14:37:26
|
| Tara if the folder is created in the database server then I may write some vb appication to store to a local drive..Thanks tara... |
 |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2004-10-04 : 16:49:06
|
| Or just connect the server to the location and create them that way...Brett8-) |
 |
|
|
jen
Master Smack Fu Yak Hacker
4110 Posts |
Posted - 2004-10-05 : 00:03:27
|
| you can explore cmdexec, which i found really awesome, since i like having a contingency plan in case the default drive gets corrupted.you can create folders on local or network drives |
 |
|
|
Shurgenz
Yak Posting Veteran
51 Posts |
Posted - 2004-10-05 : 04:50:45
|
| try xp_cmdshellDECLARE @result intEXEC @result = xp_cmdshell 'dir D:\EMP\somewhat'IF (@result = 0) PRINT 'Success' --not need to createELSE exec xp_cmdshell 'md D:\EMP\somewhat' |
 |
|
|
AndrewMurphy
Master Smack Fu Yak Hacker
2916 Posts |
Posted - 2004-10-05 : 08:44:01
|
| remember xp_cmdshell runs with SQL privilages and may (should) be locked down/out from use by regular users. |
 |
|
|
Shurgenz
Yak Posting Veteran
51 Posts |
Posted - 2004-10-05 : 08:52:01
|
| aha... it is very dangerous sp. Via xp_cmdshell you can even format disk C on the server. |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2004-10-05 : 12:22:56
|
| But he needs the directories created on the client machine not on the database server.Tara |
 |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2004-10-05 : 12:24:29
|
quote: Originally posted by tduggan But he needs the directories created on the client machine not on the database server.Tara
So....can't they use NET commands to connect to a different location and create them there..assuming security, ect...Brett8-) |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2004-10-05 : 12:27:23
|
| Sure, but that certainly shouldn't be done inside SQL Server using xp_cmdshell. This is a job for the application not a stored procedure.Tara |
 |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2004-10-05 : 12:47:22
|
| Why?I've never done that...BUT, I have managed directories/files on the box itself...Brett8-) |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2004-10-05 : 12:48:53
|
| Why would you do client side stuff at the database server level?Tara |
 |
|
|
Shurgenz
Yak Posting Veteran
51 Posts |
Posted - 2004-10-06 : 01:05:09
|
| I suppose, the folder creation, wich depends on data - is the server task, not client. |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2004-10-06 : 12:31:51
|
| Not when the folder is supposed to be created on the client.Tara |
 |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2004-10-06 : 13:17:09
|
quote: Originally posted by tduggan Not when the folder is supposed to be created on the client.Tara
I assumed it was on another file server...not a client...So I can see how that would be messyBrett8-) |
 |
|
|
|