SQL 2005 - Automatic directory creation
Hi all Hope this is the right place to post this! I have been looking for ways to do the following for a while now, and am no closer still, hope someone can help! I have a SQL database, which contains 4 tables - Customers, Suppliers, Contracts and Sites. I want to create Windows folders for each record in each of those tables, in a location of my choosing. I would like the name of each folder to be based on the record details, eg Supplier ID & Supplier Name. If subsequently, eg the supplier name changes, then the routine above would realise it is a name change and change the existing folder name, not create a new folder. I need to also create specifc subfolders within each main folder. I have to also be able to set this up so that it runs twice a day, morning and afternoon, so that any new records have folders created for them. For example, lets say I have the following records: Customer - CustomerA, customer ID 100 Contract - BuildingB, contract ID 333, CustomerA Supplier - SupplierA, supplier ID 200 Site - SiteA, site ID 300. For these records, the following folders will be created: X:/CustomersLocation/CustomerA - 100 X:/CustomersLocation/CustomerA - 100/Folder1 X:/CustomersLocation/CustomerA - 100/Folder2 X:/CustomersLocation/CustomerA - 100/Folder3 X:/CustomersLocation/CustomerA - 100/Contracts X:/CustomersLocation/CustomerA - 100/Contracts/BuildingB - 333 X:/CustomersLocation/CustomerA - 100/Contracts/BuildingB - 333/FolderF X:/CustomersLocation/CustomerA - 100/Contracts/BuildingB - 333/FolderG X:/CustomersLocation/CustomerA - 100/Contracts/BuildingB - 333/FolderH X:/SuppliersLocation/SupplierA - 200 X:/SuppliersLocation/SupplierA - 200/FolderA X:/SuppliersLocation/SupplierA - 200/FolderB X:/SuppliersLocation/SupplierA - 200/FolderC X:/SitesLocation/SiteA - 300 X:/SitesLocation/SiteA - 300/Folder100 X:/SitesLocation/SiteA - 300/Folder101 X:/SitesLocation/SiteA - 300/Folder102 Can someone please help me to try doing this? Thanks Naz
May 11th, 2012 8:09am

I think this will be much easier in .NET than in SSIS.MCTS, MCITP - Please mark posts as answered where appropriate.
Free Windows Admin Tool Kit Click here and download it now
May 11th, 2012 8:13am

Hi Naz at ANSA, I agree with Koen, I suggest you post the question to Asp.Net forum like below: http://forums.asp.net/ There are many experts focus on it, hope the issue could be resoved soon. Thanks, Eileen
May 15th, 2012 2:58am

This can easily be done using powershell. Use this to query the database: http://randypaulo.wordpress.com/2012/04/17/powershell-executing-an-sql-query-and-returning-a-disconnected-data-using-powershell/ Then to create/update folder: http://technet.microsoft.com/en-us/library/ee176914.aspx Randy Aldrich Paulo MCTS(BizTalk 2010/2006,WCF NET4.0), MCPD | My Blog BizTalk Message Archiving - SQL and File Automating/Silent Installation of BizTalk Deployment Framework using Powershell > Sending IDOCs using SSIS
Free Windows Admin Tool Kit Click here and download it now
May 15th, 2012 5:05am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics