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)
 How do I use transact sql to monitor a directory for files

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-09-06 : 09:17:27
Mohammed writes "Hello

SqlServer7 SP2
Microsoft NTserver

I want to monitor a file directory on Nt4 and as soon as some files appear I want to examin their date time stamps and then send an email.

I have managed to get SQLMail to work so that I can send an email. I have found a stored procedure to see if a file exists and another to examine attributes (xp_getfiledetails). However I do not know how to use wild cards or search for all files in the directory and then examine each file.

DECLARE @retcode int
EXEC @retcode = sp_MSexists_file 'C:\MSSQL7\BINN\', 'g.txt'
IF @retcode = 1
PRINT 'File Exist'
ELSE
PRINT 'File does not Exist'

I need to read you articles on SQLMail, as I am not sure if this is the best way to send an email.

regards
Mohammed"
   

- Advertisement -