Project Folder Creation Stored Procedure in SQL 2005

A forum for User Initated & Scheduled Workflows

Project Folder Creation Stored Procedure in SQL 2005

Postby davidsims » Fri Oct 31, 2008 9:00 am

I created the following stored procedure to create our project folder directories as part of a user initiated workflow on project creation.

First, the parameters are passed from Vision to the SP. Second, the xp_cmdshell calls the command mkdir and the path is a combination of the directory and the parameters passed from Vision. The problem is that nothing happens when this SP is initiated. I tried to also use the file path "H:/" to test it and that did not work either. Also, I am pretty sure I enabled xp_cmdshell.

Do I have a syntax error?

Code: Select all
ALTER PROCEDURE [dbo].[usp_createprojectfolders]



@group varchar(20),
@wbs1 varchar(20),
@name varchar(20)


AS

set nocount on
   
      declare @command varchar(1000)
      set @command = 'mkdir \\tg-nas02\volsharevision\projects\' + @group + '\' +@wbs1 + '_' +@name

      exec master..xp_cmdshell @command , no_output   

      set nocount off
David Sims, CPA, MSA
davidsims
 
Posts: 88
Joined: Thu Jul 24, 2008 12:53 pm

Re: Project Folder Creation Stored Procedure in SQL 2005

Postby stevestolz » Tue Nov 18, 2008 9:35 am

I'm not sure what's wrong with your code - could be a permissions issue if the user under which SQL is running does not have permission to create folders in that location.

We use a custom DLL to create Windows folders for our clients, which allows us to give feedback to the user (success or failure). The tricky part is the security (in our case the process running IIS needs remote access).

Steve
Steve Stolz
Central Consulting Group
Deltek Vision Electronic Invoicing
Deltek Vision Credit Card Reconciliation
Deltek Vision Billing Status Tracking
stevestolz
 
Posts: 19
Joined: Thu May 29, 2008 2:27 pm

Re: Project Folder Creation Stored Procedure in SQL 2005

Postby SStaats » Tue Dec 29, 2009 12:54 pm

I am in the process of setting up a Stored Procedure to create project folders as well. Have you had any luck getting your procedure to work?
SStaats
 
Posts: 2
Joined: Fri Feb 27, 2009 8:46 am

Re: Project Folder Creation Stored Procedure in SQL 2005

Postby sroth » Fri Feb 19, 2010 5:58 pm

I have managed to get the script to work, but only when I set the folder permissions to allow "Everyone" write permissions. Can anyone tell me what user SQL uses to execute this stored procedure?
sroth
 
Posts: 3
Joined: Wed Nov 12, 2008 8:28 am

Re: Project Folder Creation Stored Procedure in SQL 2005

Postby mdobler » Mon Feb 22, 2010 10:31 am

you're probably better of with some vb.net code that you can call in the workflows. That will give you more control over security and folder creation than any stored procedure
Michael Dobler
Director Deltek Solutions AB

Banks-Hill Systems Ltd.
Edmonton, AB
Canada
mdobler
 
Posts: 37
Joined: Sun May 17, 2009 2:06 pm
Location: Edmonton

Re: Project Folder Creation Stored Procedure in SQL 2005

Postby sroth » Tue Feb 23, 2010 11:25 am

SQL Server 2005 uses the "SQL Server (MSSQLSERVER)" service log on to run the stored procedures. So if you change the log on as properties to a user on the domain that has write access to your project folders, you will be able to use the workflow successfully.
sroth
 
Posts: 3
Joined: Wed Nov 12, 2008 8:28 am


Return to User Initiated & Scheduled Workflows

Who is online

Users browsing this forum: No registered users and 1 guest

cron