![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Function Main() Dim FSO Set FSO=CreateObject("Scripting.FileSystemObject") FSO.DeleteFile "C:\MSSQL\ExLogFiles\*.*" End Function Dim test test = date() path = "C:\MSSQL\ExLogFiles\" set fs = CreateObject("Scripting.FileSystemObject") set folder = fs.GetFolder(path) for each item in folder.Files 'd = DateAdd("D", -5, now() ) 'msgbox d ' if item.DateLastModified < test and NDay < 5 Then 'if (item.DateLastModified) > test-5 AND item.DateLastModified < test Then 'if item.DateCreated < test AND (item.DateCreated) > test-5 Then 'if item.DateCreated < test AND (item.DateCreated) >d Then if (item.DateLastModified) < test-0 then fs.DeleteFile path, True End If Main = DTSTaskExecResult_Success next |
#3
| |||
| |||
|
|
You have a function return value without the function here. the "Main = DTSTaskExecResult_Success" needs to be inside the function On Tue, 30 Aug 2005 13:01:09 -0700, "Sonya" <Sonya (AT) discussions (DOT) microsoft.com> wrote: Function Main() Dim FSO Set FSO=CreateObject("Scripting.FileSystemObject") FSO.DeleteFile "C:\MSSQL\ExLogFiles\*.*" End Function Dim test test = date() path = "C:\MSSQL\ExLogFiles\" set fs = CreateObject("Scripting.FileSystemObject") set folder = fs.GetFolder(path) for each item in folder.Files 'd = DateAdd("D", -5, now() ) 'msgbox d ' if item.DateLastModified < test and NDay < 5 Then 'if (item.DateLastModified) > test-5 AND item.DateLastModified < test Then 'if item.DateCreated < test AND (item.DateCreated) > test-5 Then 'if item.DateCreated < test AND (item.DateCreated) >d Then if (item.DateLastModified) < test-0 then fs.DeleteFile path, True End If Main = DTSTaskExecResult_Success next Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP) www.SQLDTS.com - The site for all your DTS needs. www.SQLIS.com - You thought DTS was good. here we show you the new stuff. www.konesans.com - Consultancy from the people who know |
#4
| |||
| |||
|
|
I moved that line inside the function and received the same error. I originally had it commented out. Any more ideas? Thanks for your response. "Allan Mitchell" wrote: You have a function return value without the function here. the "Main = DTSTaskExecResult_Success" needs to be inside the function On Tue, 30 Aug 2005 13:01:09 -0700, "Sonya" <Sonya (AT) discussions (DOT) microsoft.com> wrote: Function Main() Dim FSO Set FSO=CreateObject("Scripting.FileSystemObject") FSO.DeleteFile "C:\MSSQL\ExLogFiles\*.*" End Function Dim test test = date() path = "C:\MSSQL\ExLogFiles\" set fs = CreateObject("Scripting.FileSystemObject") set folder = fs.GetFolder(path) for each item in folder.Files 'd = DateAdd("D", -5, now() ) 'msgbox d ' if item.DateLastModified < test and NDay < 5 Then 'if (item.DateLastModified) > test-5 AND item.DateLastModified < test Then 'if item.DateCreated < test AND (item.DateCreated) > test-5 Then 'if item.DateCreated < test AND (item.DateCreated) >d Then if (item.DateLastModified) < test-0 then fs.DeleteFile path, True End If Main = DTSTaskExecResult_Success next Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP) www.SQLDTS.com - The site for all your DTS needs. www.SQLIS.com - You thought DTS was good. here we show you the new stuff. www.konesans.com - Consultancy from the people who know |
#5
| |||
| |||
|
|
And how does your function look now? On Tue, 30 Aug 2005 15:26:02 -0700, "Sonya" <Sonya (AT) discussions (DOT) microsoft.com> wrote: I moved that line inside the function and received the same error. I originally had it commented out. Any more ideas? Thanks for your response. "Allan Mitchell" wrote: You have a function return value without the function here. the "Main = DTSTaskExecResult_Success" needs to be inside the function On Tue, 30 Aug 2005 13:01:09 -0700, "Sonya" <Sonya (AT) discussions (DOT) microsoft.com> wrote: Function Main() Dim FSO Set FSO=CreateObject("Scripting.FileSystemObject") FSO.DeleteFile "C:\MSSQL\ExLogFiles\*.*" End Function Dim test test = date() path = "C:\MSSQL\ExLogFiles\" set fs = CreateObject("Scripting.FileSystemObject") set folder = fs.GetFolder(path) for each item in folder.Files 'd = DateAdd("D", -5, now() ) 'msgbox d ' if item.DateLastModified < test and NDay < 5 Then 'if (item.DateLastModified) > test-5 AND item.DateLastModified < test Then 'if item.DateCreated < test AND (item.DateCreated) > test-5 Then 'if item.DateCreated < test AND (item.DateCreated) >d Then if (item.DateLastModified) < test-0 then fs.DeleteFile path, True End If Main = DTSTaskExecResult_Success next Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP) www.SQLDTS.com - The site for all your DTS needs. www.SQLIS.com - You thought DTS was good. here we show you the new stuff. www.konesans.com - Consultancy from the people who know Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP) www.SQLDTS.com - The site for all your DTS needs. www.SQLIS.com - You thought DTS was good. here we show you the new stuff. www.konesans.com - Consultancy from the people who know |
#6
| |||
| |||
|
|
Function Main() Dim FSO Set FSO=CreateObject("Scripting.FileSystemObject") FSO.DeleteFile "C:\MSSQL\ExLogFiles\*.*" End Function Dim test test = date() path = "C:\MSSQL\ExLogFiles\" set fs = CreateObject("Scripting.FileSystemObject") set folder = fs.GetFolder(path) for each item in folder.Files 'd = DateAdd("D", -5, now() ) 'msgbox d ' if item.DateLastModified < test and NDay < 5 Then 'if (item.DateLastModified) > test-5 AND item.DateLastModified < test Then 'if item.DateCreated < test AND (item.DateCreated) > test-5 Then 'if item.DateCreated < test AND (item.DateCreated) >d Then if (item.DateLastModified) < test-0 then Main = DTSTaskExecResult_Success fs.DeleteFile path, True End If next "Allan Mitchell" wrote: And how does your function look now? On Tue, 30 Aug 2005 15:26:02 -0700, "Sonya" <Sonya (AT) discussions (DOT) microsoft.com> wrote: I moved that line inside the function and received the same error. I originally had it commented out. Any more ideas? Thanks for your response. "Allan Mitchell" wrote: You have a function return value without the function here. the "Main = DTSTaskExecResult_Success" needs to be inside the function On Tue, 30 Aug 2005 13:01:09 -0700, "Sonya" <Sonya (AT) discussions (DOT) microsoft.com> wrote: Function Main() Dim FSO Set FSO=CreateObject("Scripting.FileSystemObject") FSO.DeleteFile "C:\MSSQL\ExLogFiles\*.*" End Function Dim test test = date() path = "C:\MSSQL\ExLogFiles\" set fs = CreateObject("Scripting.FileSystemObject") set folder = fs.GetFolder(path) for each item in folder.Files 'd = DateAdd("D", -5, now() ) 'msgbox d ' if item.DateLastModified < test and NDay < 5 Then 'if (item.DateLastModified) > test-5 AND item.DateLastModified < test Then 'if item.DateCreated < test AND (item.DateCreated) > test-5 Then 'if item.DateCreated < test AND (item.DateCreated) >d Then if (item.DateLastModified) < test-0 then fs.DeleteFile path, True End If Main = DTSTaskExecResult_Success next Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP) www.SQLDTS.com - The site for all your DTS needs. www.SQLIS.com - You thought DTS was good. here we show you the new stuff. www.konesans.com - Consultancy from the people who know Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP) www.SQLDTS.com - The site for all your DTS needs. www.SQLIS.com - You thought DTS was good. here we show you the new stuff. www.konesans.com - Consultancy from the people who know |
![]() |
| Thread Tools | |
| Display Modes | |
| |