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 2000 Forums
 SQL Server Development (2000)
 Creating a directory/folder with timestamp

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2003-08-20 : 07:53:16
Randy writes "I want to create a directory/folder with timestamp suffix to it using SQL server (SQL, T-SQL, bcp) ot whatever tools is available in SQL Server.

Sample:

By using T-SQL, SQL, bcp or whatever tools available in SQL Server, I want to create a directory on my 'C' drive.

Sample: exec sp_create_directory
Output:
C:\mywork11052230

Format: C:\myworkMMDDhhmm

"

nr
SQLTeam MVY

12543 Posts

Posted - 2003-08-20 : 08:59:00
declare @cmd varchar(1000)
select @cmd = 'mkdir c:\mydir_' + convert(varchar(8),getdate(),112) + '_' + replace(convert(varchar(8),getdate(),108),':','')
master..xp_cmdshell @cmd

That's assuming that the server is on your m/c.


==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -