SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 sql server 2008 Agent job (TSQL)
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

themar42
Starting Member

8 Posts

Posted - 12/03/2012 :  15:44:52  Show Profile  Reply with Quote
Trying to create a job that steps include finding a file; copying that file; then moving the file. Upon completion an email is sent stating that the job was successful, the email subject should contain the source filename...I keep getting error: "Incorrect syntax near 'objfso'. [SQLSTATE 42000] (Error 102) "

Here's what I have so far:

Dim folder, files, newsfileSET objfso = createobject("Scripting.FileSystemObject")SET f = objfso.getfolder("\\server31\C$\test")SET fc = f.filesSET newfile =

fso.createtextfile("\file_.txt", true)



FOR each f1 IN fcIF LEFT(f1.name, 16) = "file_" then
objfso.copyfile f1, "\\server31\C$\move"
objfso.movefile f1, "\\server31\C$\move2"
SET files = f.files
FOR each "file_" IN files
newfile.writeline(fileg_.name)
nextSET objmessage = createobject("CDO.Message")
objmessage.FROM = "email@email.com"
objmessage.TO = "email@email.com"
objmessage.subject = ("the file called".newfile)
objmessage.textbody = "Job successful."
objmessage.send

endIF
next
SET objfso = nothingSET objmessage = nothing
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000